Skip to content

Commit fb78d58

Browse files
committed
Merge branch 'release/2.1.0'
2 parents 6ecfe86 + af189a0 commit fb78d58

4 files changed

Lines changed: 115 additions & 74 deletions

File tree

Docker Image/Dockerfile

Lines changed: 70 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,91 @@
11
FROM debian:jessie
22
MAINTAINER Joel Rowley <joel.rowley@wilds.org>
33

4+
LABEL vendor="The Wilds" \
5+
org.wilds.docker-wpdevenvironment.version="2.1.0"
6+
47
# Adapted and modified from the following files:
58
# - https://github.com/splattael/docker-debian-php/blob/master/jessie/Dockerfile
69
# - https://github.com/docker-library/php/blob/f016f5dc420e7d360f7381eb014ac6697e247e11/5.6/apache/Dockerfile
710

8-
ENV RELEASE_DATE 2016-07-28
911
ENV DEBIAN_FRONTEND noninteractive
1012

1113
RUN \
12-
apt-get -qq update && \
13-
apt-get -qq install \
14-
apache2 php5 php5-cli ssmtp libapache2-mod-php5 php5-mysql php5-json php5-curl php5-gd \
15-
php5-xdebug libmcrypt-dev zlib1g-dev telnet git curl vim && \
16-
apt-get clean && \
17-
rm -rf /var/lib/apt/lists/*
18-
19-
ENV MODS_AVAILABLE_PATH /etc/php5/mods-available
20-
ENV CONFD_PATH /etc/php5/apache2/conf.d
21-
22-
# Copy custom ini modules
23-
COPY mods-available/*.ini ${MODS_AVAILABLE_PATH}/
24-
25-
# Enable different module settings
26-
RUN php5enmod xdebug
27-
28-
# Make sure opcache is disabled
29-
RUN php5dismod opcache
30-
31-
ENV APACHE_CONFDIR /etc/apache2
32-
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
33-
34-
# logs should go to stdout / stderr
35-
RUN set -ex \
36-
&& . "$APACHE_ENVVARS" \
37-
&& ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \
38-
&& ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \
39-
&& ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"
40-
41-
# PHP files should be handled by PHP, and should be preferred over any other file type
42-
RUN { \
43-
echo '<FilesMatch \.php$>'; \
44-
echo '\tSetHandler application/x-httpd-php'; \
45-
echo '</FilesMatch>'; \
46-
echo; \
14+
apt-get -qq update && apt-get -qq install \
15+
apache2 \
16+
curl \
17+
git \
18+
libapache2-mod-php5 \
19+
libmcrypt-dev \
20+
php5 \
21+
php5-cli \
22+
php5-curl \
23+
php5-gd \
24+
php5-json \
25+
php5-mysql \
26+
php5-xdebug \
27+
rsync \
28+
ssmtp \
29+
telnet \
30+
vim \
31+
zlib1g-dev \
32+
&& apt-get clean \
33+
&& rm -rf /var/lib/apt/lists/*
34+
35+
ENV MODS_AVAILABLE_PATH=/etc/php5/mods-available \
36+
CONFD_PATH=/etc/php5/apache2/conf.d \
37+
APACHE_CONFDIR=/etc/apache2 \
38+
XDEBUG_REMOTE_HOST=10.0.75.1 \
39+
TIMEZONE='America/New_York' \
40+
VOLUME_PATH=/var/www/html \
41+
CERTIFICATE_PATH=/usr/local/share/ca-certificates \
42+
TERM=xterm
43+
44+
ENV APACHE_ENVVARS=$APACHE_CONFDIR/envvars
45+
46+
RUN set -e \
47+
48+
# logs should go to stdout / stderr
49+
&& . "$APACHE_ENVVARS" \
50+
&& ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \
51+
&& ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \
52+
&& ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" \
53+
54+
# PHP files should be handled by PHP, and should be preferred over any other file type
55+
&& { \
56+
57+
echo '<FilesMatch \.php$>'; \
58+
echo '\tSetHandler application/x-httpd-php'; \
59+
echo '</FilesMatch>'; \
60+
echo; \
4761
# echo 'DirectoryIndex disabled'; \
48-
echo 'DirectoryIndex index.php index.html'; \
49-
echo; \
50-
echo '<Directory /var/www/>'; \
51-
echo '\tOptions -Indexes'; \
52-
echo '\tAllowOverride All'; \
53-
echo '</Directory>'; \
54-
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
55-
&& a2enconf docker-php
56-
57-
# Enable mod_rewrite
58-
RUN a2enmod rewrite
62+
echo 'DirectoryIndex index.php index.html'; \
63+
echo; \
64+
echo '<Directory /var/www/>'; \
65+
echo '\tOptions -Indexes'; \
66+
echo '\tAllowOverride All'; \
67+
echo '</Directory>'; \
68+
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
69+
&& a2enconf docker-php \
70+
71+
# Add a symbolic link to PHP that is the same as the web host.
72+
# This is primarily for CLI php scripts run inside the container.
73+
&& ln -s $(which php) /usr/local/bin/php56
5974

6075
# Install composer
6176
RUN curl -sS https://getcomposer.org/installer | php -- \
62-
--install-dir=/usr/local/bin \
63-
--filename=composer
64-
65-
# Add a symbolic link to PHP that is the same as the web host.
66-
# This is primarily for CLI php scripts run inside the container.
67-
RUN ln -s $(which php) /usr/local/bin/php56
77+
--install-dir=/usr/local/bin \
78+
--filename=composer
6879

6980
COPY bin/* /usr/local/bin/
7081

71-
ENV TIMEZONE 'America/New_York'
72-
73-
ENV VOLUME_PATH /var/www/html
74-
ENV CERTIFICATE_PATH /usr/local/share/ca-certificates
82+
# Copy custom ini modules
83+
COPY mods-available/*.ini ${MODS_AVAILABLE_PATH}/
7584

76-
VOLUME ${VOLUME_PATH}
77-
VOLUME ${CERTIFICATE_PATH}
85+
# Enable different module settings
86+
RUN php5enmod xdebug # enable xdebug settings \
87+
&& php5dismod opcache # disable opcache \
88+
&& a2enmod rewrite # enable mod_rewrite
7889

7990
WORKDIR ${VOLUME_PATH}
8091

Docker Image/bin/setup-container

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@
33
typeset script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
44

55
. "$script_dir/timezone"
6-
. "$script_dir/create-user-from-directory-owner"
76

87
# Set timezone in container
98
_set_timezone "${TIMEZONE}"
109

1110
# Set DocumentRoot to VOLUME_PATH
1211
sed -i "s|\${VOLUME_PATH}|${VOLUME_PATH}|g" ${APACHE_CONFDIR}/apache2.conf
1312

14-
# Set Apache user/group
15-
create_user_from_directory_owner "${VOLUME_PATH}"
13+
# Make sure xdebug is going to send events back to the correct IP.
14+
sed -i "s/xdebug.remote_host=.*/xdebug.remote_host=${XDEBUG_REMOTE_HOST}/" ${MODS_AVAILABLE_PATH}/xdebug.ini
1615

1716
# Set the Apache2 ServerName to the hostname of the container
1817
echo "ServerName `hostname`" > ${APACHE_CONFDIR}/conf-available/set-hostname.conf
1918
a2enconf set-hostname
2019

21-
# Set correct permissions on certificates added to the container
22-
# This has no affect on files hosted through a volume
23-
for FILE in ${CERTIFICATE_PATH}/*; do
24-
chown root:staff $FILE
25-
chmod 775 $FILE
26-
done
20+
chown -R root:staff ${CERTIFICATE_PATH}
21+
chmod -R 775 ${CERTIFICATE_PATH}
22+
23+
# set appropriate permissions
24+
chown -R www-data:www-data "${VOLUME_PATH}"
2725

2826
exec "$@"

Docker Image/mods-available/xdebug.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ xdebug.default_enable=1
44
xdebug.remote_enable=1
55
xdebug.remote_handler=dbgp
66
xdebug.remote_port=9000
7-
xdebug.remote_connect_back=1
7+
xdebug.remote_host=CHANGEME
8+
9+
; This doesn't seem to work in Docker for Windows as the
10+
; IP that the container sees the request come from does
11+
; not equal the same IP as that of the requesting
12+
; computer.
13+
;xdebug.remote_connect_back=1
814

915
; Require the debug cookie to be sent before debugging
1016
xdebug.remote_autostart=0

docker-compose.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ services:
99
environment:
1010
- MYSQL_ROOT_PASSWORD=pw
1111
- MYSQL_DATABASE=local_db
12-
command: "/mysql.sh"
1312
volumes:
14-
- ../.docker-data/mysql:/var/lib/mysql
15-
- ./mysql.sh:/mysql.sh
13+
- docker-mysql:/var/lib/mysql
1614
restart: on-failure
1715

1816
phpmyadmin:
@@ -25,18 +23,46 @@ services:
2523
links:
2624
- mysql:db
2725

26+
vsftpd:
27+
container_name: vsftpd
28+
image: wilds/vsftpd
29+
hostname: vsftpd
30+
ports:
31+
- "21:21"
32+
- "30000-30009:30000-30009"
33+
volumes:
34+
- docker-html:/home/virtual/www-data/html
35+
- docker-certificates:/home/virtual/certs/certs
36+
- docker-mysql:/home/virtual/mysql/mysql
37+
environment:
38+
PASV_ADDRESS: 10.0.75.1
39+
PASV_MIN_PORT: 30000
40+
PASV_MAX_PORT: 30009
41+
VSFTPD_USER_1: 'www-data:ftp:33:'
42+
VSFTPD_USER_2: 'mysql:mysql:999:'
43+
VSFTPD_USER_3: 'certs:certs:50:'
44+
2845
wordpress:
2946
container_name: wordpress
3047
image: wilds/wpdevenvironment:latest
3148
hostname: wordpress
3249
environment:
3350
- TIMEZONE=America/New_York
51+
- XDEBUG_REMOTE_HOST=10.0.75.1
3452
ports:
3553
- "80:80"
3654
working_dir: /var/www/html
3755
volumes:
38-
- ../.docker-html:/var/www/html
39-
- ../.docker-certs:/usr/local/share/ca-certificates
56+
- docker-html:/var/www/html
57+
- docker-certificates:/usr/local/share/ca-certificates
4058
links:
4159
- mysql:db
4260
restart: on-failure
61+
62+
volumes:
63+
docker-mysql:
64+
external: true
65+
docker-html:
66+
external: true
67+
docker-certificates:
68+
external: true

0 commit comments

Comments
 (0)