Skip to content

Instantly share code, notes, and snippets.

@aimakun
Last active March 25, 2016 04:44
Show Gist options
  • Select an option

  • Save aimakun/d826e72667bf1982face to your computer and use it in GitHub Desktop.

Select an option

Save aimakun/d826e72667bf1982face to your computer and use it in GitHub Desktop.
Sample for docker-compose.yml & Dockerfile used in development environment
version: '2'
services:
web:
build:
context: ./docker
dockerfile: Dockerfile-web
ports:
- "80:80"
volumes_from:
- data
environment:
MYSQL_HOST: db # env variable to easy for change named services later
extra_hosts:
- "mysite.local:127.0.0.1" # Setup for self service eg. wkhtmltopdf
db:
image: aimakun/mysql
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: mysite_dev
MYSQL_ROOT_PASSWORD: root
scripts:
build:
context: ./docker
dockerfile: Dockerfile-scripts
volumes_from:
- data
data:
image: busybox
volumes:
- .:/data
FROM digitallyseamless/nodejs-bower-grunt
COPY . /data
WORKDIR /data
FROM parana/trusty-php
COPY docker-vhosts.conf /etc/apache2/sites-enabled/000-default.conf
# Set timezone
RUN echo 'date.timezone = Asia/Bangkok' > /etc/php5/apache2/php.ini
# Required extensions for this project
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
software-properties-common php5-mcrypt php-soap php5-intl \
libcurl3 php5-curl gettext \
&& php5enmod mcrypt \
&& php5enmod soap
# Install wkhtmltopdf
RUN add-apt-repository ppa:ecometrica/servers \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y xvfb wkhtmltopdf
# Setup locale & timezone
RUN locale-gen sv_SE.UTF-8
RUN locale-gen en_US.UTF-8
# Install PHPUnit 4.8 for variety of PHP versions
RUN wget https://phar.phpunit.de/phpunit-old.phar
RUN chmod +x phpunit-old.phar
RUN mv phpunit-old.phar /usr/local/bin/phpunit
# Set default volume for image
# This would be overrided by docker-compose for updatable source code between development
COPY . /data
WORKDIR /data
# Fixes user permissions for Mac OS [https://github.com/boot2docker/boot2docker/issues/581]
RUN usermod -u 1000 www-data
RUN usermod -G staff www-data
RUN apache2 -D FOREGROUND &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment