Posts

Showing posts with the label mysql

Rails & MySQL on Docker: Quick Start

This is a MySQL version of   “Quickstart: Compose and Rails” . You can create a new Ruby on Rails project with MySQL (instead of PostgreSQL) using docker-compose. 0. setup Create a directory (with any name) for the project. mkdir rails cd rails 1. prepare five files Only  docker-compose.yml  is different from the original Quickstart documentation. Dockerfile FROM ruby:2.5 RUN apt-get update -qq && apt-get install -y nodejs postgresql-client RUN mkdir /myapp WORKDIR /myapp COPY Gemfile /myapp/Gemfile COPY Gemfile.lock /myapp/Gemfile.lock RUN bundle install COPY . /myapp # Add a script to be executed every time the container starts. COPY entrypoint.sh /usr/bin/ RUN chmod +x /usr/bin/entrypoint.sh ENTRYPOINT ["entrypoint.sh"] EXPOSE 3000 # Start the main process. CMD ["rails", "server", "-b", "0.0.0.0"] Gemfile source 'https://rubygems.org' gem 'rails', '~>5' Gemfile.lock (emp...

LAMP on Docker: Quick Start

This post describes the steps to build and run a standard LAMP stack using docker-compose. You can check Mike Zazon’s great article  How to use PHP, Apache, MySQL within Docker containers  for more detail. I have simply followed it, then added some MySQL parts and so on. 1. prepare files . ├── apache │   ├── Dockerfile │   └── demo.apache.conf ├── docker-compose.yml ├── mysql │   ├── Dockerfile │   └── init │   └── 1_users.sql ├── php │   └── Dockerfile └── public_html └── index.php 1a. apache/Dockerfile FROM httpd:2.4.33-alpine RUN apk update; \ apk upgrade; # Copy apache vhost file to proxy php requests to php-fpm container COPY demo.apache.conf /usr/local/apache2/conf/demo.apache.conf RUN echo "Include /usr/local/apache2/conf/demo.apache.conf" \ >> /usr/local/apache2/conf/httpd.conf 1b. apache/demo.apache.conf ServerName localhost LoadModule deflate_module /usr/local/apache2/modules/mod_defla...