Skip to content

Commit

Permalink
restructure the erdiko images so that they more easily reused
Browse files Browse the repository at this point in the history
php versions are placed under the docker/php folders in sub folders by version number.
each container has its own compose file and the main docker-compose file uses inheritance to generate containers
  • Loading branch information
arroyo committed Nov 28, 2016
1 parent 853a0d3 commit b573d70
Show file tree
Hide file tree
Showing 42 changed files with 541 additions and 16 deletions.
27 changes: 27 additions & 0 deletions docker-compose.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '2'

services:
webserver:
extends:
file: ./docker/nginx/docker-compose.yml
service: webserver
php:
extends:
file: ./docker/php/7.0/docker-compose.yml
service: php
php71:
extends:
file: ./docker/php/7.1/docker-compose.yml
service: php
php56:
extends:
file: ./docker/php/5.6/docker-compose.yml
service: php
php55:
extends:
file: ./docker/php/5.5/docker-compose.yml
service: php
php55:
extends:
file: ./docker/php/5.4/docker-compose.yml
service: php
22 changes: 7 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@ version: '2'

services:
webserver:
container_name: erdiko_nginx
image: nginx:latest
env_file: environment.env
volumes:
- .:/code
- ./docker/nginx/site.conf:/etc/nginx/conf.d/site.conf
- ./docker/nginx/fastcgi.conf:/etc/nginx/fastcgi.conf
extends:
file: ./docker/nginx/docker-compose.yml
service: webserver
ports:
- "8088:80"
php:
container_name: erdiko_php7
env_file: environment.env
image: erdiko_php7fpm
build:
context: ./docker/php7
volumes:
- .:/code
- ./docker/php7/conf.d:/usr/local/etc/php/conf.d
extends:
file: ./docker/php/7.0/docker-compose.yml
service: php
container_name: erdiko_php
11 changes: 11 additions & 0 deletions docker/ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Docker
======

# Instructions for running a development environment with Docker
# open up docker shell, cd to your lamp docker file e.g. /docker/web and run the following commands...

#1 Build and run the Docker container

docker-compose up

# Your site is now ready
22 changes: 22 additions & 0 deletions docker/ci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '2'

services:
webserver:
container_name: erdiko_nginx
image: nginx:latest
env_file: environment.env
volumes:
- .:/code
- ./docker/nginx/site.conf:/etc/nginx/conf.d/site.conf
- ./docker/nginx/fastcgi.conf:/etc/nginx/fastcgi.conf
ports:
- "8088:80"
php:
container_name: erdiko_php7
env_file: environment.env
image: erdiko_php7fpm
build:
context: ./docker/php7
volumes:
- .:/code
- ./docker/php7/conf.d:/usr/local/etc/php/conf.d
File renamed without changes.
13 changes: 13 additions & 0 deletions docker/nginx/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '2'

services:
webserver:
container_name: erdiko_nginx
image: nginx:latest
env_file: ../environment.env
volumes:
- ../../:/code
- ./site.conf:/etc/nginx/conf.d/site.conf
- ./fastcgi.conf:/etc/nginx/fastcgi.conf
ports:
- "80:80"
2 changes: 1 addition & 1 deletion docker/php7/Dockerfile → docker/php/5.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Erdiko. It is lean enough for prod but intended for dev
############################################################

FROM php:fpm
FROM php:5.4-fpm

# File Author / Maintainer
MAINTAINER John Arroyo, [email protected]
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions docker/php/5.4/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'

services:
php:
container_name: erdiko_php_5.4
env_file: ../../environment.env
image: erdiko_phpfpm_5.4
build:
context: ./
volumes:
- ../../../:/code
- ./conf.d:/usr/local/etc/php/conf.d
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions docker/php/5.5/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
############################################################
# PHP FPM Container
#
# Contains common and useful...
# php extensions: mcrypt, gd, mysql
# linux packages: mysql-client, git, curl, wget, pwgen
#
# This is a good container for php development and includes
# common tools needed in a PHP app. Use with or without
# Erdiko. It is lean enough for prod but intended for dev
############################################################

FROM php:5.5-fpm

# File Author / Maintainer
MAINTAINER John Arroyo, [email protected]

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update \
&& apt-get install -y wget \
git \
mysql-client \
curl \
pwgen \
libmcrypt-dev \
libpng-dev \
&& docker-php-ext-install mysqli \
pdo_mysql \
mcrypt \
gd \
&& apt-get clean

# Install additional scripts (composer and phpunit)
COPY scripts /src
RUN cd /src && chmod 770 *.sh
RUN /src/composer.sh
RUN /src/phpunit.sh

EXPOSE 9000

CMD ["php-fpm"]
9 changes: 9 additions & 0 deletions docker/php/5.5/conf.d/extra.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
;/usr/local/etc/php/php.ini
; variables_order = "GPCS"
date.timezone=America/Los_Angeles

cgi.fix_pathinfo = 0

upload_max_filesize = 10M

# extension=pdo_mysql.so
12 changes: 12 additions & 0 deletions docker/php/5.5/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'

services:
php:
container_name: erdiko_php_5.5
env_file: ../../environment.env
image: erdiko_phpfpm_5.5
build:
context: ./
volumes:
- ../../../:/code
- ./conf.d:/usr/local/etc/php/conf.d
23 changes: 23 additions & 0 deletions docker/php/5.5/scripts/composer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

# from https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")

if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php

# Convenient alias (add by Erdiko)
mv composer.phar /usr/local/bin/composer
alias composer='php /usr/local/bin/composer'

exit $RESULT
6 changes: 6 additions & 0 deletions docker/php/5.5/scripts/phpdocumentor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Install phpDocumentor, http://phpdoc.org/
wget http://phpdoc.org/phpDocumentor.phar
chmod +x phpDocumentor.phar
mv phpDocumentor.phar /usr/local/bin/phpdocumentor
6 changes: 6 additions & 0 deletions docker/php/5.5/scripts/phpunit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Install Phpunit, https://phpunit.de
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit
42 changes: 42 additions & 0 deletions docker/php/5.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
############################################################
# PHP FPM Container
#
# Contains common and useful...
# php extensions: mcrypt, gd, mysql
# linux packages: mysql-client, git, curl, wget, pwgen
#
# This is a good container for php development and includes
# common tools needed in a PHP app. Use with or without
# Erdiko. It is lean enough for prod but intended for dev
############################################################

FROM php:5.6-fpm

# File Author / Maintainer
MAINTAINER John Arroyo, [email protected]

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update \
&& apt-get install -y wget \
git \
mysql-client \
curl \
pwgen \
libmcrypt-dev \
libpng-dev \
&& docker-php-ext-install mysqli \
pdo_mysql \
mcrypt \
gd \
&& apt-get clean

# Install additional scripts (composer and phpunit)
COPY scripts /src
RUN cd /src && chmod 770 *.sh
RUN /src/composer.sh
RUN /src/phpunit.sh

EXPOSE 9000

CMD ["php-fpm"]
9 changes: 9 additions & 0 deletions docker/php/5.6/conf.d/extra.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
;/usr/local/etc/php/php.ini
; variables_order = "GPCS"
date.timezone=America/Los_Angeles

cgi.fix_pathinfo = 0

upload_max_filesize = 10M

# extension=pdo_mysql.so
12 changes: 12 additions & 0 deletions docker/php/5.6/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'

services:
php:
container_name: erdiko_php_5.6
env_file: ../../environment.env
image: erdiko_phpfpm_5.6
build:
context: ./
volumes:
- ../../../:/code
- ./conf.d:/usr/local/etc/php/conf.d
23 changes: 23 additions & 0 deletions docker/php/5.6/scripts/composer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

# from https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")

if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php

# Convenient alias (add by Erdiko)
mv composer.phar /usr/local/bin/composer
alias composer='php /usr/local/bin/composer'

exit $RESULT
6 changes: 6 additions & 0 deletions docker/php/5.6/scripts/phpdocumentor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Install phpDocumentor, http://phpdoc.org/
wget http://phpdoc.org/phpDocumentor.phar
chmod +x phpDocumentor.phar
mv phpDocumentor.phar /usr/local/bin/phpdocumentor
6 changes: 6 additions & 0 deletions docker/php/5.6/scripts/phpunit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Install Phpunit, https://phpunit.de
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit
42 changes: 42 additions & 0 deletions docker/php/7.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
############################################################
# PHP FPM Container
#
# Contains common and useful...
# php extensions: mcrypt, gd, mysql
# linux packages: mysql-client, git, curl, wget, pwgen
#
# This is a good container for php development and includes
# common tools needed in a PHP app. Use with or without
# Erdiko. It is lean enough for prod or dev.
############################################################

FROM php:7.0-fpm

# File Author / Maintainer
MAINTAINER John Arroyo, [email protected]

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update \
&& apt-get install -y wget \
git \
mysql-client \
curl \
pwgen \
libmcrypt-dev \
libpng-dev \
&& docker-php-ext-install mysqli \
pdo_mysql \
mcrypt \
gd \
&& apt-get clean

# Install additional scripts (composer and phpunit)
COPY scripts /src
RUN cd /src && chmod 770 *.sh
RUN /src/composer.sh
RUN /src/phpunit.sh

EXPOSE 9000

CMD ["php-fpm"]
9 changes: 9 additions & 0 deletions docker/php/7.0/conf.d/extra.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
;/usr/local/etc/php/php.ini
; variables_order = "GPCS"
date.timezone=America/Los_Angeles

cgi.fix_pathinfo = 0

upload_max_filesize = 10M

# extension=pdo_mysql.so
Loading

0 comments on commit b573d70

Please sign in to comment.