Skip to content

Commit 1d95056

Browse files
committed
Docker composer files + Docker files
1 parent 0fa0de1 commit 1d95056

File tree

17 files changed

+386
-0
lines changed

17 files changed

+386
-0
lines changed

README.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
== Simple Docker ==
2+
3+
docker run centos:6 cat /etc/redhat-release
4+
docker run -ti centos:6 bash
5+
6+
== Docker Hub ==
7+
8+
docker pull ubuntu
9+
docker run -ti ubuntu bash
10+
apt-get update
11+
apt-get install figlet
12+
figlet phpDublin.com
13+
docker commit -m 'figlet app' -a 'Ricardo Melo' 7c367550ba16 rjsmelo/figlet-phpdublin
14+
docker push rjsmelo/figlet-phpdublin
15+
16+
== Fig up ==
17+
18+
docker-compose build
19+
docker-compose up
20+
docker-compose up -d
21+
browser (fireproxy) -> x.p55 -> x.p56 -> x.p70
22+
23+
== Wordpress ==
24+
untgz wordpress
25+
26+
docker-compose run php55 bash
27+
mysql -h mysql -u root -p
28+
create database wordpress;
29+
30+
- install using interface
31+
cd /Users/rmelo/work/docker/php-dublin/sites/wordpress/wp-content/themes/twentysixteen/
32+
vim header.php (search get_header_image)
33+
34+
<h1 style="background-color:red;"><?php echo phpversion(); ?></h1>
35+
36+
37+
38+
== Cleanup ==
39+
docker-compose kill
40+
docker-compose rm
41+
42+

docker-compose.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: '2'
2+
services:
3+
apache:
4+
build: images/apache
5+
links:
6+
- php55:php55
7+
- php56:php56
8+
- php70:php70
9+
volumes_from:
10+
- datavol
11+
ports:
12+
- 80:80
13+
- 8888:8888
14+
hostname: apache
15+
dns: 127.0.0.1
16+
command: supervisord
17+
php55:
18+
build: images/php55
19+
volumes_from:
20+
- datavol
21+
links:
22+
- mysql
23+
command: php-fpm -F
24+
hostname: php55
25+
php56:
26+
build: images/php56
27+
volumes_from:
28+
- datavol
29+
links:
30+
- mysql
31+
command: php-fpm -F
32+
hostname: php56
33+
php70:
34+
build: images/php70
35+
volumes_from:
36+
- datavol
37+
links:
38+
- mysql
39+
command: php-fpm -F
40+
hostname: php70
41+
datavol:
42+
build: images/data
43+
volumes:
44+
- /Users/rmelo/work/docker/php-dublin/sites:/var/www/html
45+
hostname: datavol
46+
mysql:
47+
image: mysql:5.6
48+
hostname: mysql
49+
environment:
50+
- MYSQL_ROOT_PASSWORD=root
51+
ports:
52+
- 3306:3306

images/apache/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM centos:6
2+
3+
# Update
4+
RUN yum -y update
5+
RUN yum install -y epel-release
6+
7+
# Apache Install
8+
RUN yum -y install httpd tinyproxy dnsmasq supervisor \
9+
&& rm /etc/httpd/conf.d/welcome.conf \
10+
&& sed -i 's,ErrorLog logs/error_log,ErrorLog /dev/stderr,' /etc/httpd/conf/httpd.conf \
11+
&& sed -i 's,CustomLog logs/access_log combined,CustomLog /dev/stdout combined,' /etc/httpd/conf/httpd.conf \
12+
&& sed -i 's,DirectoryIndex index.html index.html.var,DirectoryIndex index.php index.hh index.html index.html.var,' /etc/httpd/conf/httpd.conf \
13+
&& rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt && rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm \
14+
&& yum -y install mod_fastcgi \
15+
&& sed -i 's/^FastCgiWrapper On/FastCgiWrapper Off/' /etc/httpd/conf.d/fastcgi.conf \
16+
&& mkdir /usr/lib/cgi-bin \
17+
&& yum -y clean all
18+
19+
ADD vhosts.conf /etc/httpd/conf.d/zzz_custom.conf
20+
ADD dnsmasq.conf /etc/dnsmasq.conf
21+
ADD resolv.dnsmasq.conf /etc/resolv.dnsmasq.conf
22+
ADD tinyproxy.conf /etc/tinyproxy/tinyproxy.conf
23+
ADD supervisord.conf /etc/supervisord.conf
24+
ADD fix_resolv.sh /fix_resolv.sh
25+
26+
VOLUME /var/www/html
27+
EXPOSE 80
28+
EXPOSE 8888
29+
30+
#ENTRYPOINT ["httpd","-DFOREGROUND" ]
31+
#ENTRYPOINT ["supervisord"]

images/apache/dnsmasq.conf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
user=root
2+
no-dhcp-interface=
3+
no-hosts
4+
5+
resolv-file=/etc/resolv.dnsmasq.conf
6+
7+
address=/.p53/127.0.0.1
8+
address=/.p54/127.0.0.1
9+
address=/.p55/127.0.0.1
10+
address=/.p56/127.0.0.1
11+
address=/.p70/127.0.0.1
12+
address=/.hhvm/127.0.0.1
13+
14+
# fix to the compose DNS problem
15+
server=/php53/127.0.0.11
16+
server=/php54/127.0.0.11
17+
server=/php55/127.0.0.11
18+
server=/php56/127.0.0.11
19+
server=/php70/127.0.0.11
20+

images/apache/fix_resolv.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
echo "nameserver 127.0.0.1" > /etc/resolv.conf
4+
5+
sleep 2
6+
7+
exit 0
8+

images/apache/resolv.dnsmasq.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nameserver 8.8.8.8
2+
nameserver 8.8.4.4

images/apache/supervisord.conf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[supervisord]
2+
nodaemon=true
3+
4+
[program:apache]
5+
command = /usr/sbin/httpd -DFOREGROUND
6+
user = root
7+
autostart = true
8+
stdout_logfile=/dev/stdout
9+
stdout_logfile_maxbytes=0
10+
stderr_logfile=/dev/stderr
11+
stderr_logfile_maxbytes=0
12+
13+
[program:tinyproxy]
14+
command = /usr/sbin/tinyproxy -d
15+
user = root
16+
autostart = true
17+
stdout_logfile=/dev/stdout
18+
stdout_logfile_maxbytes=0
19+
stderr_logfile=/dev/stderr
20+
stderr_logfile_maxbytes=0
21+
22+
# Fix problem with compose DNS
23+
[program:dnsmasq-fix-resolv]
24+
command = sh /fix_resolv.sh
25+
user = root
26+
autostart = true
27+
autorestart = false
28+
startretries = 1
29+
stdout_logfile=/dev/stdout
30+
stdout_logfile_maxbytes=0
31+
stderr_logfile=/dev/stderr
32+
stderr_logfile_maxbytes=0
33+
34+
[program:dnsmasq]
35+
command = /usr/sbin/dnsmasq -k
36+
user = root
37+
autostart = true
38+
stdout_logfile=/dev/stdout
39+
stdout_logfile_maxbytes=0
40+
stderr_logfile=/dev/stderr
41+
stderr_logfile_maxbytes=0

images/apache/tinyproxy.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
User tinyproxy
2+
Group tinyproxy
3+
Port 8888
4+
Timeout 600
5+
LogLevel Info
6+
MaxClients 100
7+
MinSpareServers 2
8+
MaxSpareServers 10
9+
StartServers 5
10+
MaxRequestsPerChild 0
11+
12+
ConnectPort 443
13+
14+
Allow 127.0.0.1
15+
Allow 192.168.0.0/16
16+
Allow 172.16.0.0/12
17+
Allow 10.0.0.0/8

images/apache/vhosts.conf

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
NameVirtualHost *:80
2+
3+
<IfModule mod_fastcgi.c>
4+
# PHP 55
5+
Alias /php55-fcgi /usr/lib/cgi-bin/php55
6+
Action php55 /php55-fcgi
7+
FastCgiExternalServer /usr/lib/cgi-bin/php55 -host php55:9000 -pass-header Authorization -idle-timeout 600
8+
# PHP 56
9+
Alias /php56-fcgi /usr/lib/cgi-bin/php56
10+
Action php56 /php56-fcgi
11+
FastCgiExternalServer /usr/lib/cgi-bin/php56 -host php56:9000 -pass-header Authorization -idle-timeout 600
12+
# PHP 70
13+
Alias /php70-fcgi /usr/lib/cgi-bin/php70
14+
Action php70 /php70-fcgi
15+
FastCgiExternalServer /usr/lib/cgi-bin/php70 -host php70:9000 -pass-header Authorization -idle-timeout 600
16+
17+
<Directory /usr/lib/cgi-bin>
18+
AllowOverride All
19+
Options +ExecCGI +FollowSymLinks
20+
#Require all granted
21+
</Directory>
22+
</IfModule>
23+
24+
<VirtualHost *:80>
25+
AddHandler php55 .php
26+
DocumentRoot /var/www/html
27+
</VirtualHost>
28+
29+
<VirtualHost *:80>
30+
UseCanonicalName Off
31+
ServerName p55
32+
ServerAlias *.p55
33+
AddHandler php55 .php
34+
LogLevel Debug
35+
VirtualDocumentRoot /var/www/html/%-2+
36+
</VirtualHost>
37+
38+
<VirtualHost *:80>
39+
UseCanonicalName Off
40+
ServerName p56
41+
ServerAlias *.p56
42+
AddHandler php56 .php
43+
LogLevel Debug
44+
VirtualDocumentRoot /var/www/html/%-2+
45+
</VirtualHost>
46+
47+
<VirtualHost *:80>
48+
UseCanonicalName Off
49+
ServerName p70
50+
ServerAlias *.p70
51+
AddHandler php70 .php
52+
LogLevel Debug
53+
VirtualDocumentRoot /var/www/html/%-2+
54+
</VirtualHost>

images/data/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Dockerfile
2+
FROM centos:6
3+
4+
VOLUME /var/www/html
5+
CMD /bin/sh

images/php55/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM centos:6
2+
3+
# Update
4+
RUN yum -y update
5+
RUN yum install -y epel-release
6+
7+
8+
# PHP Install
9+
RUN yum install -y curl git \
10+
&& curl http://rpms.famillecollet.com/enterprise/remi-release-6.rpm -o /root/remi-release-6.rpm && rpm -Uvh /root/remi-release-6.rpm && rm /root/remi-release-6.rpm \
11+
&& yum install -y --enablerepo=remi,remi-php55 php php-cli php-fpm php-common php-pear php-gd php-imap php-ldap php-mbstring php-mysql php-pdo php-mcrypt php-soap php-bcmath php-xml php-xmlrpc php-pecl-xdebug mysql \
12+
&& curl http://www.phing.info/get/phing-latest.phar -o /usr/local/bin/phing && chmod a+x /usr/local/bin/phing \
13+
&& curl https://phar.phpunit.de/phpunit.phar -o /usr/local/bin/phpunit && chmod a+x /usr/local/bin/phpunit \
14+
&& curl curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin && mv /usr/local/bin/composer.phar /usr/local/bin/composer \
15+
&& sed -e 's/127.0.0.1:9000/9000/' \
16+
-e '/allowed_clients/d' \
17+
-e '/catch_workers_output/s/^;//' \
18+
-e '/error_log/d' \
19+
-i /etc/php-fpm.d/www.conf \
20+
&& yum -y clean all
21+
22+
ADD php.ini /etc/php.d/zzz_custom.ini
23+
24+
VOLUME /var/www/html
25+
EXPOSE 9000
26+
27+
#ENTRYPOINT ["php-fpm","-F"]

images/php55/php.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
post_max_size = 20M
2+
upload_max_filesize = 20M
3+
4+
; Date configuration
5+
date.timezone = "Europe/Lisbon"
6+
7+
; XDebug configuration
8+
xdebug.remote_enable=1
9+
xdebug.max_nesting_level = 1000
10+
xdebug.profiler_enable_trigger = 1
11+
xdebug.profiler_output_dir = "/var/log"

images/php56/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM centos:6
2+
3+
# Update
4+
RUN yum -y update
5+
RUN yum install -y epel-release
6+
7+
8+
# PHP Install
9+
RUN yum install -y curl git \
10+
&& curl http://rpms.famillecollet.com/enterprise/remi-release-6.rpm -o /root/remi-release-6.rpm && rpm -Uvh /root/remi-release-6.rpm && rm /root/remi-release-6.rpm \
11+
&& yum install -y --enablerepo=remi,remi-php56 php php-cli php-fpm php-common php-pear php-gd php-imap php-ldap php-mbstring php-mysql php-pdo php-mcrypt php-soap php-bcmath php-xml php-xmlrpc php-pecl-xdebug mysql \
12+
&& curl http://www.phing.info/get/phing-latest.phar -o /usr/local/bin/phing && chmod a+x /usr/local/bin/phing \
13+
&& curl https://phar.phpunit.de/phpunit.phar -o /usr/local/bin/phpunit && chmod a+x /usr/local/bin/phpunit \
14+
&& curl curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin && mv /usr/local/bin/composer.phar /usr/local/bin/composer \
15+
&& sed -e 's/127.0.0.1:9000/9000/' \
16+
-e '/allowed_clients/d' \
17+
-e '/catch_workers_output/s/^;//' \
18+
-e '/error_log/d' \
19+
-i /etc/php-fpm.d/www.conf \
20+
&& yum -y clean all
21+
22+
ADD php.ini /etc/php.d/zzz_custom.ini
23+
24+
VOLUME /var/www/html
25+
EXPOSE 9000
26+
27+
#ENTRYPOINT ["php-fpm","-F"]

images/php56/php.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
post_max_size = 20M
2+
upload_max_filesize = 20M
3+
4+
; Date configuration
5+
date.timezone = "Europe/Lisbon"
6+
7+
; XDebug configuration
8+
xdebug.remote_enable=1
9+
xdebug.max_nesting_level = 1000
10+
xdebug.profiler_enable_trigger = 1
11+
xdebug.profiler_output_dir = "/var/log"

images/php70/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM centos:6
2+
3+
# Update
4+
RUN yum -y update
5+
RUN yum install -y epel-release
6+
7+
8+
# PHP Install
9+
RUN yum install -y curl git \
10+
&& curl http://rpms.famillecollet.com/enterprise/remi-release-6.rpm -o /root/remi-release-6.rpm && rpm -Uvh /root/remi-release-6.rpm && rm /root/remi-release-6.rpm \
11+
&& yum install -y --enablerepo=remi,remi-php70 php php-cli php-fpm php-common php-pear php-gd php-imap php-ldap php-mbstring php-mysql php-pdo php-mcrypt php-soap php-bcmath php-xml php-xmlrpc php-pecl-xdebug mysql \
12+
&& curl http://www.phing.info/get/phing-latest.phar -o /usr/local/bin/phing && chmod a+x /usr/local/bin/phing \
13+
&& curl https://phar.phpunit.de/phpunit.phar -o /usr/local/bin/phpunit && chmod a+x /usr/local/bin/phpunit \
14+
&& curl curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin && mv /usr/local/bin/composer.phar /usr/local/bin/composer \
15+
&& sed -e 's/127.0.0.1:9000/9000/' \
16+
-e '/allowed_clients/d' \
17+
-e '/catch_workers_output/s/^;//' \
18+
-e '/error_log/d' \
19+
-i /etc/php-fpm.d/www.conf \
20+
&& yum -y clean all
21+
22+
ADD php.ini /etc/php.d/zzz_custom.ini
23+
24+
VOLUME /var/www/html
25+
EXPOSE 9000
26+
27+
#ENTRYPOINT ["php-fpm","-F"]

0 commit comments

Comments
 (0)