Compare commits

...

20 Commits
0.4 ... 0.8

Author SHA1 Message Date
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
32 changed files with 439 additions and 40 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

@@ -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

@@ -234,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"
###

View File

@@ -236,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"
###

View File

@@ -238,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"
###

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

@@ -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 \
@@ -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
@@ -284,6 +304,7 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
VOLUME /etc/bash-custom.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 \
@@ -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
@@ -288,6 +308,7 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
VOLUME /etc/bash-custom.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 \
@@ -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
@@ -288,6 +308,7 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
VOLUME /etc/bash-custom.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 \
@@ -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
@@ -288,6 +308,7 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
VOLUME /etc/bash-custom.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 \
@@ -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
@@ -288,6 +308,7 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
VOLUME /etc/bash-custom.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 \
@@ -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
@@ -288,6 +308,7 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
VOLUME /etc/bash-custom.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

View File

@@ -97,16 +97,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="220">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>

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 \
@@ -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
@@ -193,6 +195,7 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
###
VOLUME /etc/bash-custom.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: |
@@ -575,6 +601,9 @@ extensions_available:
build_dep: [libicu-dev]
run_dep: [libicu52]
json:
7.0:
type: builtin
build_dep: [bison]
all:
type: builtin
ldap:
@@ -678,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:
@@ -726,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}"