Compare commits

...

30 Commits
0.2 ... 0.11

Author SHA1 Message Date
cytopia
2f681bc554 Merge pull request #14 from devilbox/release-0.11
Finalize README
2018-04-21 13:57:22 +02:00
cytopia
48227f54d6 Merge pull request #13 from devilbox/release-0.10
Fix #10 WDSL via SOAP directory permissions
2018-04-21 13:19:47 +02:00
cytopia
bfde73c136 Finalize README 2018-04-21 12:48:48 +02:00
cytopia
df2a62f262 Fix #10 WDSL via SOAP directory permissions 2018-04-20 16:51:25 +02:00
cytopia
41ce37529e Merge pull request #12 from devilbox/release-0.9
Fix #11 bashrc-devilbox.d not been sourced
2018-04-20 08:32:35 +02:00
cytopia
b9c2e5ff41 Fix #11 bashrc-devilbox.d not been sourced 2018-04-19 23:22:34 +02:00
cytopia
d43225721e Merge pull request #9 from devilbox/release-0.8
Fix travis login
2018-04-12 11:56:38 +02:00
cytopia
6bc85d4878 Fix travis login 2018-04-12 08:41:27 +02:00
cytopia
ce2069d37b Merge pull request #8 from devilbox/release-0.7
Fix typo in log
2018-04-08 14:59:55 +02:00
cytopia
08e1f633fe Increase error reporting for development images 2018-04-08 12:59:54 +02:00
cytopia
8b49cd6184 Increase PHP-FPM children 2018-04-08 12:47:29 +02:00
cytopia
e072524dfd Fix typo in log 2018-04-08 12:16:52 +02:00
cytopia
3856e8d61a Merge pull request #7 from devilbox/release-0.6
Add option to customize PHP-FPM configuration
2018-04-07 19:55:06 +02:00
cytopia
116edfb3d2 Fix various broken PHP 7.0 extensions 2018-04-07 18:17:29 +02:00
cytopia
504d98b9c9 Properly handle return code after stripping libs 2018-04-07 17:18:13 +02:00
cytopia
2641449b43 Ajust php-fpm config tests 2018-04-07 15:39:45 +02:00
cytopia
69994acba3 Add option to customize PHP-FPM configuration 2018-04-07 13:49:38 +02:00
cytopia
199efdcdf3 Merge pull request #6 from devilbox/release-0.5
Release 0.5
2018-03-19 13:46:03 +01:00
cytopia
a6b1fa82a9 Fix PHP 7.2 install 2018-03-19 07:50:43 +01:00
cytopia
070e7ad7e9 Add Python requirements 2018-03-18 21:20:51 +01:00
cytopia
02d9e64233 Fix curl download 2018-03-18 18:38:18 +01:00
cytopia
cb1ff74b4d Adding: Redis tools 2018-03-18 16:42:20 +01:00
cytopia
741933918b Adding: sass 2018-03-18 16:25:44 +01:00
cytopia
b84d05844f Fix typo in bashrc 2018-03-18 16:20:03 +01:00
cytopia
29baa10b85 Adding: yamllint 2018-03-18 16:19:46 +01:00
cytopia
7af0b2c98b REL-0.5 Adding PHPCS/PHPCBF 2018-03-18 15:59:40 +01:00
cytopia
fabaf4a187 Merge pull request #5 from devilbox/release-0.4
REL-0.4 Add deprecated mongo extension
2018-03-13 06:57:52 +01:00
cytopia
eba440839a REL-0.4 Add deprecated mongo extension 2018-03-12 23:45:23 +01:00
cytopia
7cac20d86d Merge pull request #4 from devilbox/release-0.3
Release v0.3
2018-03-12 23:16:44 +01:00
cytopia
a6ed7cb16b Supress warning about tail 2018-03-05 23:50:16 +01:00
41 changed files with 1307 additions and 110 deletions

View File

@@ -95,7 +95,7 @@ before_script:
###
script:
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" &&
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin &&
if [ "${TRAVIS_BRANCH}" == "master" ]; then
docker push "${IMAGE}:${PHP}-base";
docker push "${IMAGE}:${PHP}-mods";

View File

@@ -46,7 +46,11 @@ RUN set -x \
###
RUN set -x \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###

View File

@@ -46,7 +46,11 @@ RUN set -x \
###
RUN set -x \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###

View File

@@ -46,7 +46,11 @@ RUN set -x \
###
RUN set -x \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###

View File

@@ -46,7 +46,11 @@ RUN set -x \
###
RUN set -x \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###

View File

@@ -46,7 +46,11 @@ RUN set -x \
###
RUN set -x \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###

View File

@@ -46,7 +46,11 @@ RUN set -x \
###
RUN set -x \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###

View File

@@ -62,6 +62,8 @@ set_uid() {
log "info" "Changing user '${username}' uid to: ${uid}" "${debug}"
run "usermod -u ${uid} ${username}" "${debug}"
run "chown -R ${username} ${homedir}" "${debug}"
run "chown -R ${username} /var/lib/php/session" "${debug}"
run "chown -R ${username} /var/lib/php/wsdlcache" "${debug}"
fi
fi
}
@@ -102,6 +104,8 @@ set_gid() {
log "info" "Changing group '${groupname}' gid to: ${gid}" "${debug}"
run "groupmod -g ${gid} ${groupname}" "${debug}"
run "chown -R :${groupname} ${homedir}" "${debug}"
run "chown -R :${groupname} /var/lib/php/session" "${debug}"
run "chown -R :${groupname} /var/lib/php/wsdlcache" "${debug}"
fi
fi
}

View File

@@ -1,21 +1,7 @@
[www]
; User and Group
user = devilbox
group = devilbox
; Ensure to listen here
listen = 9000
; Keep env variables set by docker
clear_env = no
; Ensure worker stdout and stderr are sent to the main error log.
catch_workers_output = yes
; Pool config
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_children = 20
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 10

View File

@@ -46,6 +46,8 @@ ENV BUILD_DEPS \
zlib1g-dev \
libmemcached-dev \
libssl-dev \
libsasl2-dev \
libssl-dev \
freetds-dev \
libfbclient2 \
libib-util \
@@ -156,6 +158,8 @@ RUN set -x \
&& docker-php-ext-enable memcache \
&& pecl install memcached-2.2.0 \
&& docker-php-ext-enable memcached \
&& yes | pecl install mongo \
&& docker-php-ext-enable mongo \
&& pecl install mongodb-1.2.11 \
&& docker-php-ext-enable mongodb \
&& pecl install msgpack-0.5.7 \
@@ -230,7 +234,7 @@ RUN set -x \
${RUN_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates \
&& find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true
&& sh -c "find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true"
###
@@ -301,6 +305,8 @@ RUN set -x \
&& php-fpm -m | grep -oiE '^memcache$' \
&& php -m | grep -oiE '^memcached$' \
&& php-fpm -m | grep -oiE '^memcached$' \
&& php -m | grep -oiE '^mongo$' \
&& php-fpm -m | grep -oiE '^mongo$' \
&& php -m | grep -oiE '^mongodb$' \
&& php-fpm -m | grep -oiE '^mongodb$' \
&& php -m | grep -oiE '^msgpack$' \

View File

@@ -46,6 +46,8 @@ ENV BUILD_DEPS \
zlib1g-dev \
libmemcached-dev \
libssl-dev \
libsasl2-dev \
libssl-dev \
freetds-dev \
libfbclient2 \
libib-util \
@@ -158,6 +160,8 @@ RUN set -x \
&& docker-php-ext-enable memcache \
&& pecl install memcached-2.2.0 \
&& docker-php-ext-enable memcached \
&& yes | pecl install mongo \
&& docker-php-ext-enable mongo \
&& pecl install mongodb \
&& docker-php-ext-enable mongodb \
&& pecl install msgpack-0.5.7 \
@@ -232,7 +236,7 @@ RUN set -x \
${RUN_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates \
&& find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true
&& sh -c "find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true"
###
@@ -303,6 +307,8 @@ RUN set -x \
&& php-fpm -m | grep -oiE '^memcache$' \
&& php -m | grep -oiE '^memcached$' \
&& php-fpm -m | grep -oiE '^memcached$' \
&& php -m | grep -oiE '^mongo$' \
&& php-fpm -m | grep -oiE '^mongo$' \
&& php -m | grep -oiE '^mongodb$' \
&& php-fpm -m | grep -oiE '^mongodb$' \
&& php -m | grep -oiE '^msgpack$' \

View File

@@ -46,6 +46,8 @@ ENV BUILD_DEPS \
zlib1g-dev \
libmemcached-dev \
libssl-dev \
libsasl2-dev \
libssl-dev \
freetds-dev \
libfbclient2 \
libib-util \
@@ -160,6 +162,8 @@ RUN set -x \
&& docker-php-ext-enable memcache \
&& pecl install memcached-2.2.0 \
&& docker-php-ext-enable memcached \
&& yes | pecl install mongo \
&& docker-php-ext-enable mongo \
&& pecl install mongodb \
&& docker-php-ext-enable mongodb \
&& pecl install msgpack-0.5.7 \
@@ -234,7 +238,7 @@ RUN set -x \
${RUN_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates \
&& find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true
&& sh -c "find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true"
###
@@ -305,6 +309,8 @@ RUN set -x \
&& php-fpm -m | grep -oiE '^memcache$' \
&& php -m | grep -oiE '^memcached$' \
&& php-fpm -m | grep -oiE '^memcached$' \
&& php -m | grep -oiE '^mongo$' \
&& php-fpm -m | grep -oiE '^mongo$' \
&& php -m | grep -oiE '^mongodb$' \
&& php-fpm -m | grep -oiE '^mongodb$' \
&& php -m | grep -oiE '^msgpack$' \

View File

@@ -40,6 +40,7 @@ ENV BUILD_DEPS \
libib-util \
firebird-dev \
libicu-dev \
bison \
libldap2-dev \
libsasl2-dev \
libmcrypt-dev \
@@ -55,7 +56,6 @@ ENV BUILD_DEPS \
libpq-dev \
libsqlite3-dev \
libpq-dev \
libssl-dev \
libpspell-dev \
libedit-dev \
libreadline-dev \
@@ -174,7 +174,6 @@ RUN set -x \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) mysqli \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) opcache \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pcntl \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pdo \
&& ln -s /usr/lib/x86_64-linux-gnu/libsybdb.* /usr/lib/ \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pdo_dblib \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pdo_firebird \
@@ -189,7 +188,6 @@ RUN set -x \
&& cd build && ./install \
&& docker-php-ext-enable phalcon \
&& cd / && rm -rf /tmp/phalcon \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) phar \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) posix \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pspell \
&& /usr/local/bin/docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) readline \
@@ -244,7 +242,7 @@ RUN set -x \
${RUN_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates \
&& find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true
&& sh -c "find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true"
###
@@ -325,8 +323,6 @@ RUN set -x \
&& php-fpm -m | grep -oiE '^Zend Opcache$' \
&& php -m | grep -oiE '^pcntl$' \
&& php-fpm -m | grep -oiE '^pcntl$' \
&& php -m | grep -oiE '^pdo$' \
&& php-fpm -m | grep -oiE '^pdo$' \
&& php -m | grep -oiE '^pdo_dblib$' \
&& php-fpm -m | grep -oiE '^pdo_dblib$' \
&& php -m | grep -oiE '^pdo_firebird$' \
@@ -341,8 +337,6 @@ RUN set -x \
&& php-fpm -m | grep -oiE '^pgsql$' \
&& php -m | grep -oiE '^phalcon$' \
&& php-fpm -m | grep -oiE '^phalcon$' \
&& php -m | grep -oiE '^phar$' \
&& php-fpm -m | grep -oiE '^phar$' \
&& php -m | grep -oiE '^posix$' \
&& php-fpm -m | grep -oiE '^posix$' \
&& php -m | grep -oiE '^pspell$' \

View File

@@ -244,7 +244,7 @@ RUN set -x \
${RUN_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates \
&& find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true
&& sh -c "find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true"
###

View File

@@ -246,7 +246,7 @@ RUN set -x \
${RUN_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates \
&& find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true
&& sh -c "find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true"
###

View File

@@ -58,6 +58,7 @@ COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf
### Volumes
###
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /var/log/php
VOLUME /var/mail

View File

@@ -58,6 +58,7 @@ COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf
### Volumes
###
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /var/log/php
VOLUME /var/mail

View File

@@ -58,6 +58,7 @@ COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf
### Volumes
###
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /var/log/php
VOLUME /var/mail

View File

@@ -58,6 +58,7 @@ COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf
### Volumes
###
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /var/log/php
VOLUME /var/mail

View File

@@ -58,6 +58,7 @@ COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf
### Volumes
###
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /var/log/php
VOLUME /var/mail

View File

@@ -58,6 +58,7 @@ COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf
### Volumes
###
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /var/log/php
VOLUME /var/mail

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
# Functions
############################################################
###
### Copy PHP-FPM *.conf files from source to destination with prefix
###
copy_fpm_files() {
local fpm_src="${1}"
local fpm_dst="${2}"
local debug="${3}"
if [ ! -d "${fpm_src}" ]; then
run "mkdir -p ${fpm_src}" "${debug}"
fi
fpm_files="$( find "${fpm_src}" -type f -iname '*.conf' )"
# loop over them line by line
IFS='
'
for fpm_f in ${fpm_files}; do
fpm_name="$( basename "${fpm_f}" )"
log "info" "PHP-FPM.conf: ${fpm_name} -> ${fpm_dst}/zzz-devilbox-${fpm_name}" "${debug}"
run "cp ${fpm_f} ${fpm_dst}/zzz-devilbox-${fpm_name}" "${debug}"
done
run "find ${fpm_dst} -type f -iname '*.conf' -exec chmod 0644 \"{}\" \;" "${debug}"
}
############################################################
# Sanity Checks
############################################################
if ! command -v find >/dev/null 2>&1; then
echo "find not found, but required."
exit 1
fi
if ! command -v basename >/dev/null 2>&1; then
echo "basename not found, but required."
exit 1
fi

View File

@@ -21,6 +21,9 @@ CONFIG_DIR="/docker-entrypoint.d"
# php.ini.d directory
PHP_INI_DIR="/usr/local/etc/php/conf.d"
# php-fpm conf.d directory
PHP_FPM_DIR="/usr/local/etc/php-fpm.d"
# This is the log file for any mail related functions
PHP_MAIL_LOG="/var/log/mail.log"
@@ -33,6 +36,9 @@ FPM_LOG_DIR="/var/log/php"
# Custom ini dir (to be copied to actual ini dir)
PHP_CUST_INI_DIR="/etc/php-custom.d"
# Custom PHP-FPM dir (to be copied to actual FPM conf dir)
PHP_CUST_FPM_DIR="/etc/php-fpm-custom.d"
# Supervisord config directory
SUPERVISOR_CONFD="/etc/supervisor/conf.d"
@@ -140,6 +146,12 @@ supervisor_add_service "php-fpm" "/usr/local/sbin/php-fpm" "${SUPERVISOR_CONFD}
copy_ini_files "${PHP_CUST_INI_DIR}" "${PHP_INI_DIR}" "${DEBUG_LEVEL}"
###
### Copy custom PHP-FPM *.conf files
###
copy_fpm_files "${PHP_CUST_FPM_DIR}" "${PHP_FPM_DIR}" "${DEBUG_LEVEL}"
###
### Startup
###

View File

@@ -70,7 +70,7 @@ trap "postfix reload" SIGHUP
postfix start
# Capture output
tail -qF -n 0 "${MAILLOG}" &
tail -qF -n 0 "${MAILLOG}" 2>/dev/null &
tail_pid="${?}"

View File

@@ -73,6 +73,7 @@ RUN set -x \
nodejs \
postgresql-client \
python-pip \
redis-tools \
rubygems \
ruby-dev \
shellcheck \
@@ -187,6 +188,16 @@ RUN set -x \
&& cd / \
&& rm -rf /usr/local/src/phalcon-devtools/.git \
\
# phpcs
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs 2>/dev/null \
&& chmod +x /usr/local/bin/phpcs \
\
# phpcbf
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf 2>/dev/null \
&& chmod +x /usr/local/bin/phpcbf \
\
# sass
&& gem install sass \
# symfony
&& curl https://symfony.com/installer -L -o /usr/local/bin/symfony \
&& chmod +x /usr/local/bin/symfony \
@@ -195,6 +206,10 @@ RUN set -x \
# wpcli
&& curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \
&& chmod +x /usr/local/bin/wp \
# yamllint
&& apt update && apt install --no-install-recommends --no-install-suggests -y libpython-dev python-setuptools libyaml-dev \
&& pip install yamllint \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps libpython-dev python-setuptools libyaml-dev && rm -rf /var/lib/apt/lists/* \
# cleanup
&& rm -rf /home/${MY_USER}/.*json \
&& rm -rf /home/${MY_USER}/.cache \
@@ -227,8 +242,8 @@ RUN \
echo "PATH=\${PATH}:/usr/local/bin:/usr/local/sbin:/usr/local/node/bin"; \
echo "export PATH"; \
echo ". /etc/bash-devilbox"; \
echo "if [ -d /etc/bash-custom.d/ ]; then"; \
echo " for f in /etc/bash-custom.d/*.sh ; do"; \
echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \
echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \
echo " if [ -r \"\${f}\" ]; then"; \
echo " . \"\${f}\""; \
echo " fi"; \
@@ -264,15 +279,20 @@ RUN set -x \
&& su - ${MY_USER} -c '/usr/local/src/linuxbrew/bin/brew --version' | grep -E 'Homebrew\s*[.0-9]+' \
&& mysqldump-secure --version | grep -E 'Version:\s*[.0-9]+' \
&& phalcon commands | grep -E '[.0-9]+' \
&& phpcs --version | grep -E 'version [.0-9]+' \
&& phpcbf --version | grep -E 'version [.0-9]+' \
&& sass --version | grep -E '[.0-9]+' \
&& symfony --version | grep -E 'version\s*[.0-9]+' \
&& webpack --version | grep -E '[.0-9]+' \
&& wp --allow-root --version | grep -E '[.0-9]+' \
&& yamllint --version 2>&1 | grep -E '[.0-9]+' \
&& true
###
### Copy files
###
COPY ./data/php.d/error-reporting.ini /usr/local/etc/php/conf.d/devilbox-error-reporting.ini
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/bash-devilbox /etc/bash-devilbox
@@ -282,8 +302,9 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
### Volumes
###
VOLUME /etc/bash-custom.d
VOLUME /etc/bashrc-devilbox.d
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /shared/backups
VOLUME /var/log/php

View File

@@ -73,6 +73,7 @@ RUN set -x \
nodejs \
postgresql-client \
python-pip \
redis-tools \
rubygems \
ruby-dev \
shellcheck \
@@ -190,6 +191,16 @@ RUN set -x \
&& cd / \
&& rm -rf /usr/local/src/phalcon-devtools/.git \
\
# phpcs
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs 2>/dev/null \
&& chmod +x /usr/local/bin/phpcs \
\
# phpcbf
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf 2>/dev/null \
&& chmod +x /usr/local/bin/phpcbf \
\
# sass
&& gem install sass \
# symfony
&& curl https://symfony.com/installer -L -o /usr/local/bin/symfony \
&& chmod +x /usr/local/bin/symfony \
@@ -198,6 +209,10 @@ RUN set -x \
# wpcli
&& curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \
&& chmod +x /usr/local/bin/wp \
# yamllint
&& apt update && apt install --no-install-recommends --no-install-suggests -y libpython-dev python-setuptools libyaml-dev \
&& pip install yamllint \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps libpython-dev python-setuptools libyaml-dev && rm -rf /var/lib/apt/lists/* \
# cleanup
&& rm -rf /home/${MY_USER}/.*json \
&& rm -rf /home/${MY_USER}/.cache \
@@ -230,8 +245,8 @@ RUN \
echo "PATH=\${PATH}:/usr/local/bin:/usr/local/sbin:/usr/local/node/bin"; \
echo "export PATH"; \
echo ". /etc/bash-devilbox"; \
echo "if [ -d /etc/bash-custom.d/ ]; then"; \
echo " for f in /etc/bash-custom.d/*.sh ; do"; \
echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \
echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \
echo " if [ -r \"\${f}\" ]; then"; \
echo " . \"\${f}\""; \
echo " fi"; \
@@ -268,15 +283,20 @@ RUN set -x \
&& su - ${MY_USER} -c '/usr/local/src/linuxbrew/bin/brew --version' | grep -E 'Homebrew\s*[.0-9]+' \
&& mysqldump-secure --version | grep -E 'Version:\s*[.0-9]+' \
&& phalcon commands | grep -E '[.0-9]+' \
&& phpcs --version | grep -E 'version [.0-9]+' \
&& phpcbf --version | grep -E 'version [.0-9]+' \
&& sass --version | grep -E '[.0-9]+' \
&& symfony --version | grep -E 'version\s*[.0-9]+' \
&& webpack --version | grep -E '[.0-9]+' \
&& wp --allow-root --version | grep -E '[.0-9]+' \
&& yamllint --version 2>&1 | grep -E '[.0-9]+' \
&& true
###
### Copy files
###
COPY ./data/php.d/error-reporting.ini /usr/local/etc/php/conf.d/devilbox-error-reporting.ini
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/bash-devilbox /etc/bash-devilbox
@@ -286,8 +306,9 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
### Volumes
###
VOLUME /etc/bash-custom.d
VOLUME /etc/bashrc-devilbox.d
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /shared/backups
VOLUME /var/log/php

View File

@@ -73,6 +73,7 @@ RUN set -x \
nodejs \
postgresql-client \
python-pip \
redis-tools \
rubygems \
ruby-dev \
shellcheck \
@@ -190,6 +191,16 @@ RUN set -x \
&& cd / \
&& rm -rf /usr/local/src/phalcon-devtools/.git \
\
# phpcs
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs 2>/dev/null \
&& chmod +x /usr/local/bin/phpcs \
\
# phpcbf
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf 2>/dev/null \
&& chmod +x /usr/local/bin/phpcbf \
\
# sass
&& gem install sass \
# symfony
&& curl https://symfony.com/installer -L -o /usr/local/bin/symfony \
&& chmod +x /usr/local/bin/symfony \
@@ -198,6 +209,10 @@ RUN set -x \
# wpcli
&& curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \
&& chmod +x /usr/local/bin/wp \
# yamllint
&& apt update && apt install --no-install-recommends --no-install-suggests -y libpython-dev python-setuptools libyaml-dev \
&& pip install yamllint \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps libpython-dev python-setuptools libyaml-dev && rm -rf /var/lib/apt/lists/* \
# cleanup
&& rm -rf /home/${MY_USER}/.*json \
&& rm -rf /home/${MY_USER}/.cache \
@@ -230,8 +245,8 @@ RUN \
echo "PATH=\${PATH}:/usr/local/bin:/usr/local/sbin:/usr/local/node/bin"; \
echo "export PATH"; \
echo ". /etc/bash-devilbox"; \
echo "if [ -d /etc/bash-custom.d/ ]; then"; \
echo " for f in /etc/bash-custom.d/*.sh ; do"; \
echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \
echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \
echo " if [ -r \"\${f}\" ]; then"; \
echo " . \"\${f}\""; \
echo " fi"; \
@@ -268,15 +283,20 @@ RUN set -x \
&& su - ${MY_USER} -c '/usr/local/src/linuxbrew/bin/brew --version' | grep -E 'Homebrew\s*[.0-9]+' \
&& mysqldump-secure --version | grep -E 'Version:\s*[.0-9]+' \
&& phalcon commands | grep -E '[.0-9]+' \
&& phpcs --version | grep -E 'version [.0-9]+' \
&& phpcbf --version | grep -E 'version [.0-9]+' \
&& sass --version | grep -E '[.0-9]+' \
&& symfony --version | grep -E 'version\s*[.0-9]+' \
&& webpack --version | grep -E '[.0-9]+' \
&& wp --allow-root --version | grep -E '[.0-9]+' \
&& yamllint --version 2>&1 | grep -E '[.0-9]+' \
&& true
###
### Copy files
###
COPY ./data/php.d/error-reporting.ini /usr/local/etc/php/conf.d/devilbox-error-reporting.ini
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/bash-devilbox /etc/bash-devilbox
@@ -286,8 +306,9 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
### Volumes
###
VOLUME /etc/bash-custom.d
VOLUME /etc/bashrc-devilbox.d
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /shared/backups
VOLUME /var/log/php

View File

@@ -73,6 +73,7 @@ RUN set -x \
nodejs \
postgresql-client \
python-pip \
redis-tools \
rubygems \
ruby-dev \
shellcheck \
@@ -190,6 +191,16 @@ RUN set -x \
&& cd / \
&& rm -rf /usr/local/src/phalcon-devtools/.git \
\
# phpcs
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs 2>/dev/null \
&& chmod +x /usr/local/bin/phpcs \
\
# phpcbf
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf 2>/dev/null \
&& chmod +x /usr/local/bin/phpcbf \
\
# sass
&& gem install sass \
# symfony
&& curl https://symfony.com/installer -L -o /usr/local/bin/symfony \
&& chmod +x /usr/local/bin/symfony \
@@ -198,6 +209,10 @@ RUN set -x \
# wpcli
&& curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \
&& chmod +x /usr/local/bin/wp \
# yamllint
&& apt update && apt install --no-install-recommends --no-install-suggests -y libpython-dev python-setuptools libyaml-dev \
&& pip install yamllint \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps libpython-dev python-setuptools libyaml-dev && rm -rf /var/lib/apt/lists/* \
# cleanup
&& rm -rf /home/${MY_USER}/.*json \
&& rm -rf /home/${MY_USER}/.cache \
@@ -230,8 +245,8 @@ RUN \
echo "PATH=\${PATH}:/usr/local/bin:/usr/local/sbin:/usr/local/node/bin"; \
echo "export PATH"; \
echo ". /etc/bash-devilbox"; \
echo "if [ -d /etc/bash-custom.d/ ]; then"; \
echo " for f in /etc/bash-custom.d/*.sh ; do"; \
echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \
echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \
echo " if [ -r \"\${f}\" ]; then"; \
echo " . \"\${f}\""; \
echo " fi"; \
@@ -268,15 +283,20 @@ RUN set -x \
&& su - ${MY_USER} -c '/usr/local/src/linuxbrew/bin/brew --version' | grep -E 'Homebrew\s*[.0-9]+' \
&& mysqldump-secure --version | grep -E 'Version:\s*[.0-9]+' \
&& phalcon commands | grep -E '[.0-9]+' \
&& phpcs --version | grep -E 'version [.0-9]+' \
&& phpcbf --version | grep -E 'version [.0-9]+' \
&& sass --version | grep -E '[.0-9]+' \
&& symfony --version | grep -E 'version\s*[.0-9]+' \
&& webpack --version | grep -E '[.0-9]+' \
&& wp --allow-root --version | grep -E '[.0-9]+' \
&& yamllint --version 2>&1 | grep -E '[.0-9]+' \
&& true
###
### Copy files
###
COPY ./data/php.d/error-reporting.ini /usr/local/etc/php/conf.d/devilbox-error-reporting.ini
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/bash-devilbox /etc/bash-devilbox
@@ -286,8 +306,9 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
### Volumes
###
VOLUME /etc/bash-custom.d
VOLUME /etc/bashrc-devilbox.d
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /shared/backups
VOLUME /var/log/php

View File

@@ -73,6 +73,7 @@ RUN set -x \
nodejs \
postgresql-client \
python-pip \
redis-tools \
rubygems \
ruby-dev \
shellcheck \
@@ -190,6 +191,16 @@ RUN set -x \
&& cd / \
&& rm -rf /usr/local/src/phalcon-devtools/.git \
\
# phpcs
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs 2>/dev/null \
&& chmod +x /usr/local/bin/phpcs \
\
# phpcbf
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf 2>/dev/null \
&& chmod +x /usr/local/bin/phpcbf \
\
# sass
&& gem install sass \
# symfony
&& curl https://symfony.com/installer -L -o /usr/local/bin/symfony \
&& chmod +x /usr/local/bin/symfony \
@@ -198,6 +209,10 @@ RUN set -x \
# wpcli
&& curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \
&& chmod +x /usr/local/bin/wp \
# yamllint
&& apt update && apt install --no-install-recommends --no-install-suggests -y libpython-dev python-setuptools libyaml-dev \
&& pip install yamllint \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps libpython-dev python-setuptools libyaml-dev && rm -rf /var/lib/apt/lists/* \
# cleanup
&& rm -rf /home/${MY_USER}/.*json \
&& rm -rf /home/${MY_USER}/.cache \
@@ -230,8 +245,8 @@ RUN \
echo "PATH=\${PATH}:/usr/local/bin:/usr/local/sbin:/usr/local/node/bin"; \
echo "export PATH"; \
echo ". /etc/bash-devilbox"; \
echo "if [ -d /etc/bash-custom.d/ ]; then"; \
echo " for f in /etc/bash-custom.d/*.sh ; do"; \
echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \
echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \
echo " if [ -r \"\${f}\" ]; then"; \
echo " . \"\${f}\""; \
echo " fi"; \
@@ -268,15 +283,20 @@ RUN set -x \
&& su - ${MY_USER} -c '/usr/local/src/linuxbrew/bin/brew --version' | grep -E 'Homebrew\s*[.0-9]+' \
&& mysqldump-secure --version | grep -E 'Version:\s*[.0-9]+' \
&& phalcon commands | grep -E '[.0-9]+' \
&& phpcs --version | grep -E 'version [.0-9]+' \
&& phpcbf --version | grep -E 'version [.0-9]+' \
&& sass --version | grep -E '[.0-9]+' \
&& symfony --version | grep -E 'version\s*[.0-9]+' \
&& webpack --version | grep -E '[.0-9]+' \
&& wp --allow-root --version | grep -E '[.0-9]+' \
&& yamllint --version 2>&1 | grep -E '[.0-9]+' \
&& true
###
### Copy files
###
COPY ./data/php.d/error-reporting.ini /usr/local/etc/php/conf.d/devilbox-error-reporting.ini
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/bash-devilbox /etc/bash-devilbox
@@ -286,8 +306,9 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
### Volumes
###
VOLUME /etc/bash-custom.d
VOLUME /etc/bashrc-devilbox.d
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /shared/backups
VOLUME /var/log/php

View File

@@ -73,6 +73,7 @@ RUN set -x \
nodejs \
postgresql-client \
python-pip \
redis-tools \
rubygems \
ruby-dev \
shellcheck \
@@ -190,6 +191,16 @@ RUN set -x \
&& cd / \
&& rm -rf /usr/local/src/phalcon-devtools/.git \
\
# phpcs
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs 2>/dev/null \
&& chmod +x /usr/local/bin/phpcs \
\
# phpcbf
&& curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf 2>/dev/null \
&& chmod +x /usr/local/bin/phpcbf \
\
# sass
&& gem install sass \
# symfony
&& curl https://symfony.com/installer -L -o /usr/local/bin/symfony \
&& chmod +x /usr/local/bin/symfony \
@@ -198,6 +209,10 @@ RUN set -x \
# wpcli
&& curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \
&& chmod +x /usr/local/bin/wp \
# yamllint
&& apt update && apt install --no-install-recommends --no-install-suggests -y libpython-dev python-setuptools libyaml-dev \
&& pip install yamllint \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps libpython-dev python-setuptools libyaml-dev && rm -rf /var/lib/apt/lists/* \
# cleanup
&& rm -rf /home/${MY_USER}/.*json \
&& rm -rf /home/${MY_USER}/.cache \
@@ -230,8 +245,8 @@ RUN \
echo "PATH=\${PATH}:/usr/local/bin:/usr/local/sbin:/usr/local/node/bin"; \
echo "export PATH"; \
echo ". /etc/bash-devilbox"; \
echo "if [ -d /etc/bash-custom.d/ ]; then"; \
echo " for f in /etc/bash-custom.d/*.sh ; do"; \
echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \
echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \
echo " if [ -r \"\${f}\" ]; then"; \
echo " . \"\${f}\""; \
echo " fi"; \
@@ -268,15 +283,20 @@ RUN set -x \
&& su - ${MY_USER} -c '/usr/local/src/linuxbrew/bin/brew --version' | grep -E 'Homebrew\s*[.0-9]+' \
&& mysqldump-secure --version | grep -E 'Version:\s*[.0-9]+' \
&& phalcon commands | grep -E '[.0-9]+' \
&& phpcs --version | grep -E 'version [.0-9]+' \
&& phpcbf --version | grep -E 'version [.0-9]+' \
&& sass --version | grep -E '[.0-9]+' \
&& symfony --version | grep -E 'version\s*[.0-9]+' \
&& webpack --version | grep -E '[.0-9]+' \
&& wp --allow-root --version | grep -E '[.0-9]+' \
&& yamllint --version 2>&1 | grep -E '[.0-9]+' \
&& true
###
### Copy files
###
COPY ./data/php.d/error-reporting.ini /usr/local/etc/php/conf.d/devilbox-error-reporting.ini
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/bash-devilbox /etc/bash-devilbox
@@ -286,8 +306,9 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
### Volumes
###
VOLUME /etc/bash-custom.d
VOLUME /etc/bashrc-devilbox.d
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /shared/backups
VOLUME /var/log/php

View File

@@ -45,7 +45,7 @@ echo " | node | https://nodejs.org |"
echo " | npm | https://www.npmjs.com |"
echo " | phalcon-devtools | gh: phalcon/phalcon-devtools |"
echo " | symfony installer| gh: symfony/symfony-installer|"
echo " | webpack | ghL webpack/webpack |"
echo " | webpack | gh: webpack/webpack |"
echo " | wpcli | https://wp-cli.org |"
echo
echo

View File

@@ -21,6 +21,9 @@ CONFIG_DIR="/docker-entrypoint.d"
# php.ini.d directory
PHP_INI_DIR="/usr/local/etc/php/conf.d"
# php-fpm conf.d directory
PHP_FPM_DIR="/usr/local/etc/php-fpm.d"
# This is the log file for any mail related functions
PHP_MAIL_LOG="/var/log/mail.log"
@@ -33,6 +36,9 @@ FPM_LOG_DIR="/var/log/php"
# Custom ini dir (to be copied to actual ini dir)
PHP_CUST_INI_DIR="/etc/php-custom.d"
# Custom PHP-FPM dir (to be copied to actual FPM conf dir)
PHP_CUST_FPM_DIR="/etc/php-fpm-custom.d"
# Supervisord config directory
SUPERVISOR_CONFD="/etc/supervisor/conf.d"
@@ -140,6 +146,12 @@ supervisor_add_service "php-fpm" "/usr/local/sbin/php-fpm" "${SUPERVISOR_CONFD}
copy_ini_files "${PHP_CUST_INI_DIR}" "${PHP_INI_DIR}" "${DEBUG_LEVEL}"
###
### Copy custom PHP-FPM *.conf files
###
copy_fpm_files "${PHP_CUST_FPM_DIR}" "${PHP_FPM_DIR}" "${DEBUG_LEVEL}"
###
### mysqldump-secure
###

View File

@@ -0,0 +1,12 @@
; PHP Development configuration for errors
; Show all errors
display_errors = On
display_startup_errors = On
; Log all errors
log_errors = On
; What errors to show/log
error_reporting = E_ALL | E_STRICT
xmlrpc_errors = On

831
README.md
View File

@@ -1,11 +1,507 @@
# Docker PHP-FPM images
# PHP-FPM Docker images
<h2><img id="options" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Options</h2>
[![Build Status](https://travis-ci.org/devilbox/docker-php-fpm.svg?branch=master)](https://travis-ci.org/devilbox/docker-php-fpm)
[![Join the chat at https://gitter.im/devilbox/Lobby](https://badges.gitter.im/devilbox/Lobby.svg)](https://gitter.im/devilbox/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![](https://images.microbadger.com/badges/license/devilbox/php-fpm.svg)](https://microbadger.com/images/devilbox/php-fpm "php-fpm")
[![Github](https://img.shields.io/badge/github-docker--php--fpm-red.svg)](https://github.com/devilbox/docker-php-fpm)
### Environment variables
**[devilbox/docker-php-fpm](https://github.com/devilbox/docker-php-fpm)**
This repository will provide you fully functional PHP-FPM Docker images in different flavours,
versions and packed with different types of integrated PHP modules. It also solves the problem of [syncronizing file permissions](#unsynchronized-permissions) of mounted volumes between the host and the container.
| Docker Hub | Upstream Project |
|------------|------------------|
| <a href="https://hub.docker.com/r/devilbox/php-fpm"><img height="82px" src="http://dockeri.co/image/devilbox/php-fpm" /></a> | <a href="https://github.com/cytopia/devilbox" ><img height="82px" src="https://raw.githubusercontent.com/devilbox/artwork/master/submissions_banner/cytopia/01/png/banner_256_trans.png" /></a> |
---
#### Table of Contents
1. **[Motivation](#motivation)**
1. [Unsynchronized permissions](#unsynchronized-permissions)
2. [It gets even worse](#it-gets-even-worse)
3. [The solution](#the-solution)
2. **[PHP-FPM Flavours](#php-fpm-flavours)**
1. [Assembly](#assembly)
2. [Available Images](#available-images)
3. [Tagging](#tagging)
4. [PHP Modules](#php-modules)
3. **[PHP-FPM Features](#php-fpm-features)**
1. [Image: base](#image-base)
2. [Image: mods](#image-mods)
3. [Image: prod](#image-prod)
4. [Image: work](#image-work)
4. **[PHP-FPM Options](#php-fpm-options)**
1. [Environment variables](#environment-variables)
2. [Volumes](#volumes)
3. [Ports](#ports)
5. **[Integrated Development Environment](#integrated-development-environment)**
1. [What toos can you expect](#what-tools-can-you-expect)
2. [What else is available](#what-else-is-available)
6. **[Examples](#examples)**
1. [Provide PHP-FPM port to host](#provide-php-fpm-port-to-host)
2. [Alter PHP-FPM and system timezone](#alter-php-fpm-and-system-timezone)
3. [Load custom PHP configuration](#load-custom-php-configuration)
4. [Load custom PHP modules](#load-custom-php-modules)
5. [MySQL connect via 127.0.0.1 (via port-forward)](#mysql-connect-via-127-0-0-1-via-port-forward-)
6. [MySQL and Redis connect via 127.0.0.1 (via port-forward)](#mysql-and-redis-connect-via-127-0-0-1-via-port-forward-)
7. [Launch Postfix for mail-catching](#launch-postfix-for-mail-catching)
8. [Webserver and PHP-FPM](#webserver-and-php-fpm)
9. [Create MySQL Backups](#create-mysql-backups)
7. **[Automated builds](#automated-builds)**
8. **[Contributing](#contributing)**
9. **[Credits](#credits)**
10. **[License](#license)**
----
<h2><img id="motivation" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Motivation</h2>
One main problem with a running Docker container is to **synchronize the ownership of files in a mounted volume** in order to preserve security (Not having to use `chmod 0777`).
#### Unsynchronized permissions
Consider the following directory structure of a mounted volume. Your hosts computer uid/gid are `1000` which does not have a corresponding user/group within the container. Fortunately the `tmp/` directory allows everybody to create new files in it.
```shell
[Host] | [Container]
------------------------------------------------------------------------------------------
$ ls -l | $ ls -l
-rw-r--r-- user group index.php | -rw-r--r-- 1000 1000 index.php
drwxrwxrwx user group tmp/ | drwxrwxrwx 1000 1000 tmp/
```
Your web application might now have created some temporary files (via the PHP-FPM process) inside the `tmp/` directory:
```shell
[Host] | [Container]
------------------------------------------------------------------------------------------
$ ls -l tmp/ | $ ls -l tmp/
-rw-r--r-- 96 96 _tmp_cache01.php | -rw-r--r-- www www _tmp_cache01.php
-rw-r--r-- 96 96 _tmp_cache02.php | -rw-r--r-- www www _tmp_cache01.php
```
On the Docker container side everything is still fine, but on your host computers side, those files now show a user id and group id of `96`, which is in fact the uid/gid of the PHP-FPM process running inside the container. On the host side you will now have to use `sudo` in order to delete/edit those files.
#### It gets even worse
Consider your had created the `tmp/` directory on your host only with `0775` permissions:
```shell
[Host] | [Container]
------------------------------------------------------------------------------------------
$ ls -l | $ ls -l
-rw-r--r-- user group index.php | -rw-r--r-- 1000 1000 index.php
drwxrwxr-x user group tmp/ | drwxrwxr-x 1000 1000 tmp/
```
If your web application now wants to create some temporary files (via the PHP-FPM process) inside the `tmp/` directory, it will fail due to lacking permissions.
#### The solution
To overcome this problem, it must be made sure that the PHP-FPM process inside the container runs under the same uid/gid as your local user that mouns the volumes and also wants to work on those files locally. However, you never know during Image build time what user id this would be. Therefore it must be something that can be changed during startup of the container.
This is achieved by two environment variables that can be provided during startup in order to change the uid/gid of the PHP-FPM user prior starting up PHP-FPM.
```shell
$ docker run -e NEW_UID=1000 -e NEW_GID=1000 -it devilbox/php-fpm:7.2-base
[INFO] Changing user 'devilbox' uid to: 1000
root $ usermod -u 1000 devilbox
[INFO] Changing group 'devilbox' gid to: 1000
root $ groupmod -g 1000 devilbox
[INFO] Starting PHP 7.2.0 (fpm-fcgi) (built: Oct 30 2017 12:05:19)
```
When **`NEW_UID`** and **`NEW_GID`** are provided to the startup command, the container will do a `usermod` and `groupmod` prior starting up in order to assign new uid/gid to the PHP-FPM user. When the PHP-FPM process finally starts up it actually runs with your local system user and making sure permissions will be in sync from now on.
At a minimum those two environment variables are offered by all flavours and types of the here provided PHP-FPM images.
**Note:**
To tackle this on the PHP-FPM side is only half a solution to the problem. The same applies to a web server Docker container when you offer **file uploads**. They will be uploaded and created by the web servers uid/gid. Therefore the web server itself must also provide the same kind of solution. See the following Web server Docker images for how this is done:
**[Apache 2.2](https://github.com/devilbox/docker-apache-2.2)** |
**[Apache 2.4](https://github.com/devilbox/docker-apache-2.4)** |
**[Nginx stable](https://github.com/devilbox/docker-nginx-stable)** |
**[Nginx mainline](https://github.com/devilbox/docker-nginx-mainline)**
<h2><img id="php-fpm-flavours" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> PHP-FPM Flavours</h2>
#### Assembly
The provided Docker images heavily rely on inheritance to guarantee smallest possible image size. Each of them provide a working PHP-FPM server and you must decide what version works best for you. Look at the sketch below to get an overview about the two provided flavours and each of their different types.
```shell
[PHP] # Base FROM image (Official PHP-FPM image)
^ #
| #
| #
[base] # Introduces env variables and adjusts entrypoint
^ #
| #
| #
[mods] # Installs additional PHP modules
^ # via pecl, git and other means
| #
| #
[prod] # Devilbox flavour for production
^ # (locales, postifx, socat and injectables)
| # (custom modules and *.ini files)
| #
[work] # Devilbox flavour for local development
# (includes backup and development tools)
# (sudo, custom bash and tool configs)
```
#### Available Images
The following table shows a more complete overview about the offered Docker images and what they should be used for.
<table>
<thead>
<tr>
<th width="80">Type</th>
<th width="280">Docker Image</th>
<th width="320">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="6"><strong>base</strong></td>
<td><code>devilbox/php-fpm:5.4-base</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.4-base.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.4-base.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:5.5-base</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.5-base.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.5-base.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:5.6-base</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.6-base.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.6-base.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.0-base</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.0-base.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.0-base.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.1-base</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.1-base.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.1-base.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.2-base</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.2-base.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.2-base.svg" /></a>
</td>
</tr>
<tr>
<td rowspan="6"><strong>mods</strong></td>
<td><code>devilbox/php-fpm:5.4-mods</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.4-mods.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.4-mods.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:5.5-mods</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.5-mods.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.5-mods.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:5.6-mods</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.6-mods.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.6-mods.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.0-mods</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.0-mods.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.0-mods.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.1-mods</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.1-mods.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.1-mods.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.2-mods</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.2-mods.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.2-mods.svg" /></a>
</td>
</tr>
<tr>
<td rowspan="6"><strong>prod</strong></td>
<td><code>devilbox/php-fpm:5.4-prod</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.4-prod.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.4-prod.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:5.5-prod</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.5-prod.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.5-prod.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:5.6-prod</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.6-prod.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.6-prod.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.0-prod</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.0-prod.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.0-prod.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.1-prod</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.1-prod.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.1-prod.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.2-prod</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.2-prod.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.2-prod.svg" /></a>
</td>
</tr>
<tr>
<td rowspan="6"><strong>work</strong></td>
<td><code>devilbox/php-fpm:5.4-work</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.4-work.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.4-work.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:5.5-work</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.5-work.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.5-work.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:5.6-work</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:5.6-work.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:5.6-work.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.0-work</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.0-work.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.0-work.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.1-work</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.1-work.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.1-work.svg" /></a>
</td>
</tr>
<tr>
<td><code>devilbox/php-fpm:7.2-work</code></td>
<td>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/image/devilbox/php-fpm:7.2-work.svg" /></a>
<a href="https://microbadger.com/images/devilbox/php-fpm"><img src="https://images.microbadger.com/badges/version/devilbox/php-fpm:7.2-work.svg" /></a>
</td>
</tr>
</tbody>
</table>
#### Tagging
This repository uses Docker tags to refer to different flavours and types of the PHP-FPM Docker image. Therefore `:latest` and `:<git-branch-name>` as well as `:<git-tag-name>` must be presented differently. Refer to the following table to see how tagged Docker images are produced at Docker hub:
<table>
<thead>
<tr>
<th width="190">Meant Tag</th>
<th width="300">Actual Tag</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>:latest</code></td>
<td>
<code>:X.Y-base</code><br/>
<code>:X.Y-mods</code><br/>
<code>:X.Y-prod</code><br/>
<code>:X.Y-work</code><br/>
</td>
<td>Stable<br/><sub>(rolling)</sub><br/><br/>These tags are produced by the master branch of this repository.</td>
</tr>
<tr>
<td><code>:&lt;git-tag-name&gt;</code></td>
<td>
<code>:X.Y-base-&lt;git-tag-name&gt;</code><br/>
<code>:X.Y-mods-&lt;git-tag-name&gt;</code><br/>
<code>:X.Y-prod-&lt;git-tag-name&gt;</code><br/>
<code>:X.Y-work-&lt;git-tag-name&gt;</code><br/>
</td>
<td>Stable<br/><sub>(fixed)</sub><br/><br/>Every git tag will produce and preserve these Docker tags.</td>
</tr>
<tr>
<td><code>:&lt;git-branch-name&gt;</code></td>
<td>
<code>:X.Y-base-&lt;git-branch-name&gt;</code><br/>
<code>:X.Y-mods-&lt;git-branch-name&gt;</code><br/>
<code>:X.Y-prod-&lt;git-branch-name&gt;</code><br/>
<code>:X.Y-work-&lt;git-branch-name&gt;</code><br/>
</td>
<td>Feature<br/><sub>(for testing)</sub><br/><br/>Tags produced by unmerged branches. Do not rely on them as they might come and go.</td>
</tr>
</tbody>
</table>
#### PHP Modules
Check out this table to see which Docker image provides what PHP modules.
<table>
<thead>
<tr>
<th></th>
<th width="45%"><code>base</code></th>
<th width="45%"><code>mods</code>, <code>prod</code> and <code>work</code></th>
</tr>
</thead>
<tbody>
<tr>
<th>5.4</th>
<td id="54-base">Core, ctype, curl, date, dom, ereg, fileinfo, filter, hash, iconv, json, libxml, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, recode, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="54-mods">amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongo, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>5.5</th>
<td id="55-base">Core, ctype, curl, date, dom, ereg, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="55-mods">amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongo, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>5.6</th>
<td id="56-base">Core, ctype, curl, date, dom, ereg, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="56-mods">amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongo, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>7.0</th>
<td id="70-base">Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="70-mods">amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>7.1</th>
<td id="71-base">Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="71-mods">amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>7.2</th>
<td id="72-base">Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="72-mods">amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, sodium, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
</tbody>
</table>
<h2><img id="php-fpm-features" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> PHP-FPM Features</h2>
#### Image: base
```shell
docker pull devilbox/php-fpm:5.4-base
docker pull devilbox/php-fpm:5.5-base
docker pull devilbox/php-fpm:5.6-base
docker pull devilbox/php-fpm:7.0-base
docker pull devilbox/php-fpm:7.1-base
docker pull devilbox/php-fpm:7.2-base
```
Generic PHP-FPM base image. Use it to derive your own php-fpm docker image from it and add more extensions, tools and injectables.<br/><br/><sub>(Does not offer any environment variables except for `NEW_UID` and `NEW_GID`)</sub>
#### Image: mods
```shell
docker pull devilbox/php-fpm:5.4-mods
docker pull devilbox/php-fpm:5.5-mods
docker pull devilbox/php-fpm:5.6-mods
docker pull devilbox/php-fpm:7.0-mods
docker pull devilbox/php-fpm:7.1-mods
docker pull devilbox/php-fpm:7.2-mods
```
Generic PHP-FPM image with fully loaded extensions. Use it to derive your own php-fpm docker image from it and add more extensions, tools and injectables.<br/><br/><sub>(Does not offer any environment variables except for `NEW_UID` and `NEW_GID`)</sub></td>
#### Image: prod
```shell
docker pull devilbox/php-fpm:5.4-prod
docker pull devilbox/php-fpm:5.5-prod
docker pull devilbox/php-fpm:5.6-prod
docker pull devilbox/php-fpm:7.0-prod
docker pull devilbox/php-fpm:7.1-prod
docker pull devilbox/php-fpm:7.2-prod
```
Devilbox production image. This Docker image comes with many injectables, port-forwardings, mail-catch-all and user/group rewriting.
#### Image: work
```shell
docker pull devilbox/php-fpm:5.4-work
docker pull devilbox/php-fpm:5.5-work
docker pull devilbox/php-fpm:5.6-work
docker pull devilbox/php-fpm:7.0-work
docker pull devilbox/php-fpm:7.1-work
docker pull devilbox/php-fpm:7.2-work
```
Devilbox development image. Same as prod, but comes with lots of locally installed tools to make development inside the container as convenient as possible. See [Integrated Development Environment](#integrated-development-environment) for more information about this.
<h2><img id="php-fpm-options" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> PHP-FPM Options</h2>
#### Environment variables
Have a look at the following table to see all supported environment variables for each Docker image flavour.
<table>
<thead>
<tr>
@@ -89,7 +585,7 @@ Have a look at the following table to see all supported environment variables fo
</tbody>
</table>
### Volumes
#### Volumes
Have a look at the following table to see all offered volumes for each Docker image flavour.
@@ -97,16 +593,20 @@ Have a look at the following table to see all offered volumes for each Docker im
<thead>
<tr>
<th>Image</th>
<th width="200">Volumes</th>
<th width="240">Volumes</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="4"><strong>prod</strong><br/><br/><strong>work</strong></td>
<td rowspan="5"><strong>prod</strong><br/><br/><strong>work</strong></td>
<td><code>/etc/php-custom.d</code></td>
<td>Mount this directory into your host computer and add custom <code>\*.ini</code> files in order to alter php behaviour.</td>
</tr>
<tr>
<td><code>/etc/php-fpm-custom.d</code></td>
<td>Mount this directory into your host computer and add custom PHP-FOM <code>\*.conf</code> files in order to alter PHP-FPM behaviour.</td>
</tr>
<tr>
<td><code>/etc/php-modules.d</code></td>
<td>Mount this directory into your host computer and add custo <code>\*.so</code> files in order to add your php modules.<br/><br/><strong>Note:</strong>Your should then also provide a custom <code>\*.ini</code> file in order to actually load your custom provided module.</td>
@@ -124,7 +624,7 @@ Have a look at the following table to see all offered volumes for each Docker im
</tr>
<tr>
<td rowspan="2"><strong>work</strong></td>
<td><code>/etc/bash-custom.d</code></td>
<td><code>/etc/bashrc-devilbox.d</code></td>
<td>Mount this directory into your host computer and add custom configuration files for <code>bash</code> and other tools.</td>
</tr>
<tr>
@@ -135,7 +635,7 @@ Have a look at the following table to see all offered volumes for each Docker im
</table>
### Ports
#### Ports
Have a look at the following table to see all offered exposed ports for each Docker image flavour.
@@ -158,47 +658,292 @@ Have a look at the following table to see all offered exposed ports for each Doc
<h2><img id="integrated-development-environment" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Integrated Development Environment</h2>
<h2><img id="modules" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Modules</h2>
If you plan to use the PHP-FPM image for development, hence being able to execute common commands inside the container itself, you should go with the **work** Image.
The **work** Docker image has many common tools already installed which on one hand increases its image size, but on the other hand removes the necessity to install those tools locally.
You want to use tools such as `git`, `drush`, `composer`, `npm`, `eslint`, `phpcs` as well as many others, simply do it directly inside the container. As all Docker images are auto-built every night by travis-ci it is assured that you are always at the latest version of your favorite dev tool.
#### What tools can you expect
<table>
<thead>
<tr>
<th></th>
<th width="45%"><code>base</code></th>
<th width="45%"><code>mods</code>, <code>prod</code> and <code>work</code></th>
<th width="200">Tool</th>
<th>Description</th>
</tr>
</thead>
<tr>
<td><a href="https://github.com/cytopia/awesome-ci">awesome-ci</a></td>
<td>Various linting and source code analyzing tools.</td>
</tr>
<tr>
<td><a href="https://getcomposer.org">composer</a></td>
<td>Dependency Manager for PHP.</td>
</tr>
<tr>
<td><a href="https://drupalconsole.com">drupal-console</a></td>
<td>The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.</td>
</tr>
<tr>
<td><a href="http://www.drush.org">drush</a></td>
<td>Drush is a computer software shell-based application used to control, manipulate, and administer Drupal websites.</td>
</tr>
<tr>
<td><a href="https://eslint.org">eslint</a></td>
<td>The pluggable linting utility for JavaScript and JSX.</td>
</tr>
<tr>
<td><a href="https://git-scm.com">git</a></td>
<td>Git is a version control system for tracking changes in source files.</td>
</tr>
<tr>
<td><a href="https://github.com/nvie/gitflow">git-flow</a></td>
<td>Git-flow tools.</td>
</tr>
<tr>
<td><a href="https://gulpjs.com/">gulp</a></td>
<td>Gulp command line JS tool.</td>
</tr>
<tr>
<td><a href="https://gruntjs.com/">grunt</a></td>
<td>Grunt command line JS tool.</td>
</tr>
<tr>
<td><a href="https://github.com/zaach/jsonlint">jsonlint</a></td>
<td>Json command line linter.</td>
</tr>
<tr>
<td><a href="https://github.com/laravel/installer">laravel installer</a></td>
<td>A CLI tool to easily install and manage the laravel framework.</td>
</tr>
<tr>
<td><a href="http://linuxbrew.sh">linuxbrew</a></td>
<td>The Homebrew package manager for Linux.</td>
</tr>
<tr>
<td><a href="https://github.com/markdownlint/markdownlint">mdl</a></td>
<td>Markdown command line linter.</td>
</tr>
<tr>
<td><a href="https://github.com/ChrisWren/mdlint">mdlint</a></td>
<td>Markdown command line linter.</td>
</tr>
<tr>
<td><a href="https://mysqldump-secure.org">mysqldump-secure</a></td>
<td>Secury MySQL database backup tool with encryption.</td>
</tr>
<tr>
<td><a href="https://nodejs.org">nodejs</a></td>
<td>Node.js is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side.</td>
</tr>
<tr>
<td><a href="https://www.npmjs.com">npm</a></td>
<td>npm is a package manager for the JavaScript programming language.</td>
</tr>
<tr>
<td><a href="https://github.com/phalcon/phalcon-devtools">phalcon-devtools</a></td>
<td>CLI tool to generate code helping to develop faster and easy applications that use with Phalcon framework.</td>
</tr>
<tr>
<td><a href="https://github.com/squizlabs/PHP_CodeSniffer">phpcs</a></td>
<td>PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.</td>
</tr>
<tr>
<td><a href="https://github.com/squizlabs/PHP_CodeSniffer">phpcbf</a></td>
<td>PHP Code Beautifier and Fixer.</td>
</tr>
<tr>
<td><a href="http://sass-lang.com/">sass</a></td>
<td>Sass CSS compiler.</td>
</tr>
<tr>
<td><a href="https://github.com/brigade/scss-lint">scss-lint</a></td>
<td>Sass/CSS command line linter.</td>
</tr>
<tr>
<td><a href="https://github.com/symfony/symfony-installer">symfony installer</a></td>
<td>This is the official installer to start new projects based on the Symfony full-stack framework.</td>
</tr>
<tr>
<td><a href="https://github.com/jonas/tig">tig</a></td>
<td>Text-mode Interface for Git.</td>
</tr>
<tr>
<td><a href="https://github.com/webpack/webpack">webpack</a></td>
<td>A bundler for javascript and friends.</td>
</tr>
<tr>
<td><a href="https://wp-cli.org">wp-cli</a></td>
<td>WP-CLI is the command-line interface for WordPress.</td>
</tr>
<tr>
<td><a href="https://github.com/adrienverge/yamllint">yamllint</a></td>
<td>Yaml command line linter.</td>
</tr>
<tr>
<td><a href="https://yarnpkg.com/en">yarn</a></td>
<td>Fast, reliable and secure dependency management.</td>
</tr>
<tbody>
<tr>
<th>5.4</th>
<td id="54-base">Core, ctype, curl, date, dom, ereg, fileinfo, filter, hash, iconv, json, libxml, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, recode, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="54-mods">amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>5.5</th>
<td id="55-base">Core, ctype, curl, date, dom, ereg, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="55-mods">amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>5.6</th>
<td id="56-base">Core, ctype, curl, date, dom, ereg, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="56-mods">amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>7.0</th>
<td id="70-base">Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="70-mods">amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>7.1</th>
<td id="71-base">Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="71-mods">amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
<tr>
<th>7.2</th>
<td id="72-base">Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib</td>
<td id="72-mods">amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, sodium, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib</td>
</tr>
</tbody>
</table>
#### What else is available
Apart from the provided tools, you will also be able to use the container similar as you would do with your host system. Just a few things to mention here:
* Mount custom bash configuration files so your config persists between restarts
* Use password-less `sudo` to become root and do whatever you need to do
If there is anything else you'd like to be able to do, drop me an issue.
<h2><img id="examples" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Examples</h2>
#### Provide PHP-FPM port to host
```shell
$ docker run -d \
-p 127.0.0.1:9000:9000 \
-t devilbox/php-fpm:7.2-prod
```
#### Alter PHP-FPM and system timezone
```shell
$ docker run -d \
-p 127.0.0.1:9000:9000 \
-e TIMEZONE=Europe/Berlin \
-t devilbox/php-fpm:7.2-prod
```
#### Load custom PHP configuration
`config/` is a local directory that will hold the PHP *.ini files you want to load into the Docker container.
```shell
# Create config directory to be mounted with dummy configuration
$ mkdir config
$ echo "xdebug.enable = 1" > config/xdebug.ini
# Run container and mount it
$ docker run -d \
-p 127.0.0.1:9000:9000 \
-v config:/etc/php-custom.d \
-t devilbox/php-fpm:7.2-prod
```
#### Load custom PHP modules
`modules/` is a local directory that will hold the PHP modules you want to mount into the Docker container. `config/` is a local directory that will hold the PHP *.ini files you want to load into the Docker container.
```shell
# Create module directory and place module into it
$ mkdir modules
$ cp /my/module/phalcon.so modules/
# Custom php config to load this module
$ mkdir config
$ echo "extension=/etc/php-modules.d/phalcon.so" > config/phalcon.ini
# Run container and mount it
$ docker run -d \
-p 127.0.0.1:9000:9000 \
-v config:/etc/php-custom.d \
-v modules:/etc/php-modules.d \
-t devilbox/php-fpm:7.2-prod
```
#### MySQL connect via 127.0.0.1 (via port-forward)
Forward MySQL Port from `172.168.0.30` (or any other IP address/hostname) and Port `3306` to the PHP docker on `127.0.0.1:3306`. By this, your PHP files inside the docker can use `127.0.0.1` to connect to a MySQL database.
```shell
$ docker run -d \
-p 127.0.0.1:9000:9000 \
-e FORWARD_PORTS_TO_LOCALHOST='3306:172.168.0.30:3306' \
-t devilbox/php-fpm:7.2-prod
```
#### MySQL and Redis connect via 127.0.0.1 (via port-forward)
Forward MySQL Port from `172.168.0.30:3306` and Redis port from `redis:6379` to the PHP docker on `127.0.0.1:3306` and `127.0.0.1:6379`. By this, your PHP files inside the docker can use `127.0.0.1` to connect to a MySQL or Redis database.
```shell
$ docker run -d \
-p 127.0.0.1:9000:9000 \
-e FORWARD_PORTS_TO_LOCALHOST='3306:172.168.0.30:3306, 6379:redis:6379' \
-t devilbox/php-fpm:7.2-prod
```
#### Launch Postfix for mail-catching
Once you set `$ENABLE_MAIL=1`, all mails sent via any of your PHP applications no matter to which domain, are catched locally into the `devilbox` account. You can also mount the mail directory locally to hook in with mutt and read those mails.
```shell
$ docker run -d \
-p 127.0.0.1:9000:9000 \
-v /tmp/mail:/var/mail \
-e ENABLE_MAIL=1 \
-t devilbox/php-fpm:7.2-prod
```
#### Webserver and PHP-FPM
`~/my-host-www` will be the directory that serves the php files (your document root). Make sure to mount it into both, php and the webserver.
```shell
# Start PHP-FPM container
$ docker run -d \
-v ~/my-host-www:/var/www/default/htdocs \
--name php \
-t devilbox/php-fpm:7.2-prod
# Start webserver and link with PHP-FPM
$ docker run -d \
-p 80:80 \
-v ~/my-host-www:/var/www/default/htdocs \
-e PHP_FPM_ENABLE=1 \
-e PHP_FPM_SERVER_ADDR=php \
-e PHP_FPM_SERVER_PORT=9000 \
--link php \
-t devilbox/nginx-mainline
```
#### Create MySQL Backups
**Note:** This will only work with `work` Docker images.
The MySQL server could be another Docker container linked to the PHP-FPM container. Let's assume the PHP-FPM container is able to access the MySQL container by the hostname `mysql`.
```
# Start container
$ docker run -d \
-e MYSQL_BACKUP_USER=root \
-e MYSQL_BACKUP_PASS=somepass \
-e MYSQL_BACKUP_HOST=mysql \
-v ~/backups:/shared/backsup \
--name php \
-t devilbox/php-fpm:7.2-work
# Run database dump
$ docker exec -it php mysqldump-secure
```
<h2><img id="automated-builds" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Automated builds</h2>
[![Build Status](https://travis-ci.org/devilbox/docker-php-fpm.svg?branch=master)](https://travis-ci.org/devilbox/docker-php-fpm)
Docker images are built and tested every night by **[travis-ci](https://travis-ci.org/devilbox/docker-php-fpm)** and pushed to **[Docker hub](https://hub.docker.com/r/devilbox/php-fpm/)** on success. This is all done automatically to ensure that sources as well as base images are always fresh and in case of security updates always have the latest patches.
<h2><img id="contributing" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Contributing</h2>
Contributors are welcome. Feel free to star and clone this repository and submit issues and pull-requests. Add examples and show what you have created with the provided images. If you see any errors or ways to improve this repository in any way, please do so.
<h2><img id="credits" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Credits</h2>
* **[cytopia](https://github.com/cytopia)**
<h2><img id="license" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> License</h2>
**[MIT License](LICENSE.md)**
Copyright (c) 2017 [cytopia](https://github.com/cytopia)

View File

@@ -46,7 +46,11 @@ RUN set -x \
###
RUN set -x \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###

View File

@@ -161,7 +161,7 @@ RUN set -x \
${RUN_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates \
&& find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true
&& sh -c "find /usr/local -type f -perm /u+x -exec strip --strip-all '{}' + || true"
{% if debug %}

View File

@@ -60,6 +60,7 @@ COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf
### Volumes
###
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /var/log/php
VOLUME /var/mail

View File

@@ -88,6 +88,7 @@ RUN set -x \
nodejs \
postgresql-client \
python-pip \
redis-tools \
rubygems \
ruby-dev \
shellcheck \
@@ -144,8 +145,8 @@ RUN \
echo "PATH=\${PATH}:/usr/local/bin:/usr/local/sbin:/usr/local/node/bin"; \
echo "export PATH"; \
echo ". /etc/bash-devilbox"; \
echo "if [ -d /etc/bash-custom.d/ ]; then"; \
echo " for f in /etc/bash-custom.d/*.sh ; do"; \
echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \
echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \
echo " if [ -r \"\${f}\" ]; then"; \
echo " . \"\${f}\""; \
echo " fi"; \
@@ -182,6 +183,7 @@ RUN set -x \
###
### Copy files
###
COPY ./data/php.d/error-reporting.ini /usr/local/etc/php/conf.d/devilbox-error-reporting.ini
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/bash-devilbox /etc/bash-devilbox
@@ -191,8 +193,9 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
### Volumes
###
VOLUME /etc/bash-custom.d
VOLUME /etc/bashrc-devilbox.d
VOLUME /etc/php-custom.d
VOLUME /etc/php-fpm-custom.d
VOLUME /etc/php-modules.d
VOLUME /shared/backups
VOLUME /var/log/php

View File

@@ -61,9 +61,13 @@ software_enabled:
- linuxbrew
- mysqldumpsecure
- phalcon
- phpcs
- phpcbf
- sass
- symfony
- webpack
- wpcli
- yamllint
# Cleanup needs to be last
- cleanup
@@ -289,6 +293,22 @@ software_available:
&& ln -s /usr/local/src/phalcon-devtools/phalcon.php /usr/local/bin/phalcon \
&& cd / \
&& rm -rf /usr/local/src/phalcon-devtools/.git \
phpcs:
check: phpcs --version | grep -E 'version [.0-9]+'
all:
command: |
curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs 2>/dev/null \
&& chmod +x /usr/local/bin/phpcs \
phpcbf:
check: phpcbf --version | grep -E 'version [.0-9]+'
all:
command: |
curl -q https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf 2>/dev/null \
&& chmod +x /usr/local/bin/phpcbf \
sass:
check: sass --version | grep -E '[.0-9]+'
all:
command: gem install sass
symfony:
check: symfony --version | grep -E 'version\s*[.0-9]+'
all:
@@ -303,6 +323,12 @@ software_available:
check: webpack --version | grep -E '[.0-9]+'
all:
command: npm install -g webpack webpack-cli
yamllint:
check: yamllint --version 2>&1 | grep -E '[.0-9]+'
all:
pre: apt update && apt install --no-install-recommends --no-install-suggests -y libpython-dev python-setuptools libyaml-dev
command: pip install yamllint
post: apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps libpython-dev python-setuptools libyaml-dev && rm -rf /var/lib/apt/lists/*
cleanup:
all:
command: |
@@ -366,6 +392,7 @@ extensions_enabled:
- mcrypt
- memcache
- memcached
- mongo
- mongodb
- msgpack
- mysql
@@ -574,6 +601,9 @@ extensions_available:
build_dep: [libicu-dev]
run_dep: [libicu52]
json:
7.0:
type: builtin
build_dep: [bison]
all:
type: builtin
ldap:
@@ -625,6 +655,12 @@ extensions_available:
type: pecl
build_dep: [zlib1g-dev, libmemcached-dev]
run_dep: [libmemcachedutil2]
mongo:
disabled: [7.0, 7.1, 7.2] # Deprecated
all:
type: pecl
command: yes | pecl install mongo
build_dep: [libssl-dev, libsasl2-dev]
mongodb:
5.4:
type: pecl
@@ -671,6 +707,8 @@ extensions_available:
pcre:
disabled: "{{ php_all_versions }}" # Available by default
pdo:
# https://github.com/docker-library/php/issues/618
disabled: [7.0] # TODO: Currently disabled due to bug in built
all:
type: builtin
pdo_dblib:
@@ -719,6 +757,8 @@ extensions_available:
git_ref: $(git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | tail -1 | sed 's/^.*tags\///g')
command: cd build && ./install
phar:
# https://github.com/docker-library/php/issues/618
disabled: [7.0] # TODO: Currently disabled due to bug in built
all:
type: builtin
build_dep: [libssl-dev]

View File

@@ -71,8 +71,8 @@ run "sleep 10"
###
### Check correct PHP-FPM user
###
if ! docker_exec "${did}" "ps aux | grep 'php-fpm: pool' | grep -v grep | awk '{ print \$1 }' | head -1 | grep devilbox"; then
docker_exec "${did}" "ps aux"
if ! docker_exec "${did}" "ps auxw | grep 'php-fpm: pool' | grep -v grep | awk '{ print \$1 }' | head -1 | grep devilbox"; then
docker_exec "${did}" "ps auxw"
# Shutdown
docker_stop "${ndid}" || true
@@ -82,8 +82,8 @@ if ! docker_exec "${did}" "ps aux | grep 'php-fpm: pool' | grep -v grep | awk '{
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "ps aux | grep 'php-fpm: pool' | grep -v grep | awk '{ print \$1 }' | tail -1 | grep devilbox"; then
docker_exec "${did}" "ps aux"
if ! docker_exec "${did}" "ps auxw | grep 'php-fpm: pool' | grep -v grep | awk '{ print \$1 }' | tail -1 | grep devilbox"; then
docker_exec "${did}" "ps auxw"
# Shutdown
docker_stop "${ndid}" || true

View File

@@ -0,0 +1,162 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
IMAGE="${1}"
VERSION="${2}"
FLAVOUR="${3}"
# shellcheck disable=SC1090
. "${CWD}/../.lib.sh"
############################################################
# Tests
############################################################
###
### Test Nginx with PHP-FPM
###
WWW_PORT="23254"
DOC_ROOT_HOST="$( mktemp -d )"
DOC_ROOT_CONT="/var/www/default"
CONFIG_HOST="$( mktemp -d )"
CONFIG_CONT="/etc/nginx/conf.d"
PHP_CNF_HOST="$( mktemp -d )"
PHP_CNF_CONT="/etc/php-fpm-custom.d"
CONTAINER="nginx:stable"
printf "[www]\nphp_admin_value[memory_limit] = 17M\n" > "${PHP_CNF_HOST}/post.conf"
echo "<?php phpinfo();" > "${DOC_ROOT_HOST}/index.php"
# Fix mount permissions
chmod 0777 "${CONFIG_HOST}"
chmod 0777 "${PHP_CNF_HOST}"
chmod 0777 "${DOC_ROOT_HOST}"
chmod 0644 "${DOC_ROOT_HOST}/index.php"
# Pull container
run "docker pull ${CONTAINER}"
# Start PHP-FPM
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2 -e NEW_UID=$(id -u) -e NEW_GID=$(id -g) -v ${DOC_ROOT_HOST}:${DOC_ROOT_CONT} -v ${PHP_CNF_HOST}:${PHP_CNF_CONT}" )"
name="$( docker_name "${did}" )"
# Nginx.conf
{
echo "server {"
echo " server_name _;"
echo " listen 80;"
echo " root ${DOC_ROOT_CONT};"
echo " index index.php;"
echo " location ~* \.php\$ {"
echo " fastcgi_index index.php;"
echo " fastcgi_pass ${name}:9000;"
echo " include fastcgi_params;"
echo " fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;"
echo " fastcgi_param SCRIPT_NAME \$fastcgi_script_name;"
echo " }"
echo "}"
} > "${CONFIG_HOST}/php.conf"
# Start Nginx
ndid="$( docker_run "${CONTAINER}" "-v ${DOC_ROOT_HOST}:${DOC_ROOT_CONT} -v ${CONFIG_HOST}:${CONFIG_CONT} -p ${WWW_PORT}:80 --link ${name}" )"
# Wait for both containers to be up and running
run "sleep 10"
# Check entrypoint
if ! run "docker logs ${did} | grep 'post.conf'"; then
docker_logs "${ndid}" || true
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${DOC_ROOT_HOST}"
rm -rf "${CONFIG_HOST}"
rm -rf "${PHP_CNF_HOST}"
echo "Failed"
exit 1
fi
# Check PHP connectivity
if ! run "curl -q -4 http://127.0.0.1:${WWW_PORT}/index.php >/dev/null 2>&1"; then
# Info
run "netstat -tuln"
run "curl -4 http://127.0.0.1:${WWW_PORT}/index.php" || true
run "curl -6 http://127.0.0.1:${WWW_PORT}/index.php" || true
run "docker ps --no-trunc"
docker_exec "${ndid}" "nginx -t"
# Show logs
docker_logs "${ndid}" || true
docker_logs "${did}" || true
# Ensure file is available
docker_exec "${ndid}" "ls -la ${DOC_ROOT_CONT}/"
docker_exec "${did}" "ls -la ${DOC_ROOT_CONT}/"
docker_exec "${ndid}" "cat ${DOC_ROOT_CONT}/index.php"
docker_exec "${did}" "cat ${DOC_ROOT_CONT}/index.php"
# Nginx configuration
docker_exec "${ndid}" "cat ${CONFIG_CONT}/php.conf"
# Shutdown
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${DOC_ROOT_HOST}"
rm -rf "${CONFIG_HOST}"
rm -rf "${PHP_CNF_HOST}"
echo "Failed"
exit 1
fi
# Check modified php-fpm.conf
if ! run "curl -q -4 http://127.0.0.1:${WWW_PORT}/index.php 2>/dev/null | grep memory_limit | grep '17M'"; then
# Info
run "netstat -tuln"
run "curl -4 http://127.0.0.1:${WWW_PORT}/index.php | grep memory_limit" || true
run "docker ps --no-trunc"
docker_exec "${ndid}" "nginx -t"
# Show logs
docker_logs "${ndid}" || true
docker_logs "${did}" || true
# Ensure file is available
docker_exec "${ndid}" "ls -la ${DOC_ROOT_CONT}/"
docker_exec "${did}" "ls -la ${DOC_ROOT_CONT}/"
docker_exec "${ndid}" "cat ${DOC_ROOT_CONT}/index.php"
docker_exec "${did}" "cat ${DOC_ROOT_CONT}/index.php"
# Nginx configuration
docker_exec "${ndid}" "cat ${CONFIG_CONT}/php.conf"
# Shutdown
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${DOC_ROOT_HOST}"
rm -rf "${CONFIG_HOST}"
rm -rf "${PHP_CNF_HOST}"
echo "Failed"
exit 1
fi
# Cleanup
docker_stop "${did}"
docker_stop "${ndid}"
rm -rf "${DOC_ROOT_HOST}"
rm -rf "${CONFIG_HOST}"
rm -rf "${PHP_CNF_HOST}"