diff --git a/Dockerfiles/base/data/docker-entrypoint.d/00-base-libs.sh b/Dockerfiles/base/data/docker-entrypoint.d/100-base-libs.sh similarity index 100% rename from Dockerfiles/base/data/docker-entrypoint.d/00-base-libs.sh rename to Dockerfiles/base/data/docker-entrypoint.d/100-base-libs.sh diff --git a/Dockerfiles/base/data/docker-entrypoint.d/01-uid-gid.sh b/Dockerfiles/base/data/docker-entrypoint.d/101-uid-gid.sh similarity index 100% rename from Dockerfiles/base/data/docker-entrypoint.d/01-uid-gid.sh rename to Dockerfiles/base/data/docker-entrypoint.d/101-uid-gid.sh diff --git a/Dockerfiles/prod/Dockerfile-5.2 b/Dockerfiles/prod/Dockerfile-5.2 index 4e307076..75b89538 100644 --- a/Dockerfiles/prod/Dockerfile-5.2 +++ b/Dockerfiles/prod/Dockerfile-5.2 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-5.3 b/Dockerfiles/prod/Dockerfile-5.3 index 632c8480..a3fc49b4 100644 --- a/Dockerfiles/prod/Dockerfile-5.3 +++ b/Dockerfiles/prod/Dockerfile-5.3 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-5.4 b/Dockerfiles/prod/Dockerfile-5.4 index 5aac5d84..6365cdc7 100644 --- a/Dockerfiles/prod/Dockerfile-5.4 +++ b/Dockerfiles/prod/Dockerfile-5.4 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-5.5 b/Dockerfiles/prod/Dockerfile-5.5 index 6d21f47f..b97f6873 100644 --- a/Dockerfiles/prod/Dockerfile-5.5 +++ b/Dockerfiles/prod/Dockerfile-5.5 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-5.6 b/Dockerfiles/prod/Dockerfile-5.6 index 32927d9a..d4aa7c77 100644 --- a/Dockerfiles/prod/Dockerfile-5.6 +++ b/Dockerfiles/prod/Dockerfile-5.6 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-7.0 b/Dockerfiles/prod/Dockerfile-7.0 index cfd1d081..f2e1c97c 100644 --- a/Dockerfiles/prod/Dockerfile-7.0 +++ b/Dockerfiles/prod/Dockerfile-7.0 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-7.1 b/Dockerfiles/prod/Dockerfile-7.1 index badd9f03..723efc48 100644 --- a/Dockerfiles/prod/Dockerfile-7.1 +++ b/Dockerfiles/prod/Dockerfile-7.1 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-7.2 b/Dockerfiles/prod/Dockerfile-7.2 index 37de975f..b51c04da 100644 --- a/Dockerfiles/prod/Dockerfile-7.2 +++ b/Dockerfiles/prod/Dockerfile-7.2 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-7.3 b/Dockerfiles/prod/Dockerfile-7.3 index 83f108b9..6c7e4dbe 100644 --- a/Dockerfiles/prod/Dockerfile-7.3 +++ b/Dockerfiles/prod/Dockerfile-7.3 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/Dockerfile-7.4 b/Dockerfiles/prod/Dockerfile-7.4 index 0cace179..0ec2dd3f 100644 --- a/Dockerfiles/prod/Dockerfile-7.4 +++ b/Dockerfiles/prod/Dockerfile-7.4 @@ -24,6 +24,7 @@ RUN set -x \ locales-all \ postfix \ postfix-pcre \ + cron \ rsyslog \ socat \ supervisor \ @@ -72,9 +73,6 @@ 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 diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/30-timezone.sh b/Dockerfiles/prod/data/docker-entrypoint.d/300-timezone.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/30-timezone.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/300-timezone.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/31-postfix.sh b/Dockerfiles/prod/data/docker-entrypoint.d/301-postfix.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/31-postfix.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/301-postfix.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/32-docker-logs.sh b/Dockerfiles/prod/data/docker-entrypoint.d/302-docker-logs.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/32-docker-logs.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/302-docker-logs.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/33-socat-port-forwarding.sh b/Dockerfiles/prod/data/docker-entrypoint.d/303-socat-port-forwarding.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/33-socat-port-forwarding.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/303-socat-port-forwarding.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/34-supervisor.sh b/Dockerfiles/prod/data/docker-entrypoint.d/304-supervisor.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/34-supervisor.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/304-supervisor.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/35-custom-ini-files.sh b/Dockerfiles/prod/data/docker-entrypoint.d/305-custom-ini-files.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/35-custom-ini-files.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/305-custom-ini-files.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/36-custom-php-fpm-files.sh b/Dockerfiles/prod/data/docker-entrypoint.d/306-custom-php-fpm-files.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/36-custom-php-fpm-files.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/306-custom-php-fpm-files.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/37-fix-php-5.3-env-vars.sh b/Dockerfiles/prod/data/docker-entrypoint.d/307-fix-php-5.3-env-vars.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/37-fix-php-5.3-env-vars.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/307-fix-php-5.3-env-vars.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/38-enable-modules.sh b/Dockerfiles/prod/data/docker-entrypoint.d/308-enable-modules.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/38-enable-modules.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/308-enable-modules.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/39-disable-modules.sh b/Dockerfiles/prod/data/docker-entrypoint.d/309-disable-modules.sh similarity index 100% rename from Dockerfiles/prod/data/docker-entrypoint.d/39-disable-modules.sh rename to Dockerfiles/prod/data/docker-entrypoint.d/309-disable-modules.sh diff --git a/Dockerfiles/prod/data/docker-entrypoint.d/310-custom-startup-scripts.sh b/Dockerfiles/prod/data/docker-entrypoint.d/310-custom-startup-scripts.sh new file mode 100755 index 00000000..49d251b4 --- /dev/null +++ b/Dockerfiles/prod/data/docker-entrypoint.d/310-custom-startup-scripts.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + + +############################################################ +# Functions +############################################################ + +### +### Execute custom uesr-supplied scripts +### +execute_custom_scripts() { + local script_dir="${1}" + local debug="${2}" + + if [ ! -d "${script_dir}" ]; then + run "mkdir -p ${script_dir}" "${debug}" + fi + script_files="$( find "${script_dir}" -type f -iname '*.sh' )" + + # loop over them line by line + IFS=' + ' + for script_f in ${script_files}; do + script_name="$( basename "${script_f}" )" + log "info" "Executing custom startup script: ${script_name}" "${debug}" + if ! bash "${script_f}"; then + log "err" "Failed to execute script" "${debug}" + exit 1 + fi + done +} + + +############################################################ +# 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 diff --git a/Dockerfiles/prod/data/docker-entrypoint.sh b/Dockerfiles/prod/data/docker-entrypoint.sh index 970820d9..4f9f669d 100755 --- a/Dockerfiles/prod/data/docker-entrypoint.sh +++ b/Dockerfiles/prod/data/docker-entrypoint.sh @@ -178,6 +178,13 @@ enable_modules "ENABLE_MODULES" "${DEBUG_LEVEL}" disable_modules "DISABLE_MODULES" "${DEBUG_LEVEL}" +### +### Run custom user supplied scripts +### +execute_custom_scripts "/startup.d" "${DEBUG_LEVEL}" + + +### ### ### Startup ### diff --git a/Dockerfiles/work/Dockerfile-5.2 b/Dockerfiles/work/Dockerfile-5.2 index ad3a0d38..3f4e3bee 100644 --- a/Dockerfiles/work/Dockerfile-5.2 +++ b/Dockerfiles/work/Dockerfile-5.2 @@ -328,10 +328,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-5.3 b/Dockerfiles/work/Dockerfile-5.3 index 872ba7c0..64af1ce7 100644 --- a/Dockerfiles/work/Dockerfile-5.3 +++ b/Dockerfiles/work/Dockerfile-5.3 @@ -371,10 +371,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-5.4 b/Dockerfiles/work/Dockerfile-5.4 index 1b3b6612..b4995206 100644 --- a/Dockerfiles/work/Dockerfile-5.4 +++ b/Dockerfiles/work/Dockerfile-5.4 @@ -404,10 +404,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-5.5 b/Dockerfiles/work/Dockerfile-5.5 index 9f559dc3..29191dfc 100644 --- a/Dockerfiles/work/Dockerfile-5.5 +++ b/Dockerfiles/work/Dockerfile-5.5 @@ -418,10 +418,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-5.6 b/Dockerfiles/work/Dockerfile-5.6 index bd96cc50..61a8d28c 100644 --- a/Dockerfiles/work/Dockerfile-5.6 +++ b/Dockerfiles/work/Dockerfile-5.6 @@ -432,10 +432,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-7.0 b/Dockerfiles/work/Dockerfile-7.0 index 914662da..d1429a9c 100644 --- a/Dockerfiles/work/Dockerfile-7.0 +++ b/Dockerfiles/work/Dockerfile-7.0 @@ -432,10 +432,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-7.1 b/Dockerfiles/work/Dockerfile-7.1 index 4660996a..9158f495 100644 --- a/Dockerfiles/work/Dockerfile-7.1 +++ b/Dockerfiles/work/Dockerfile-7.1 @@ -432,10 +432,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-7.2 b/Dockerfiles/work/Dockerfile-7.2 index ea0b1cfd..63ed8635 100644 --- a/Dockerfiles/work/Dockerfile-7.2 +++ b/Dockerfiles/work/Dockerfile-7.2 @@ -432,10 +432,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-7.3 b/Dockerfiles/work/Dockerfile-7.3 index c98b19ca..c812fe5c 100644 --- a/Dockerfiles/work/Dockerfile-7.3 +++ b/Dockerfiles/work/Dockerfile-7.3 @@ -420,10 +420,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/Dockerfile-7.4 b/Dockerfiles/work/Dockerfile-7.4 index 15713a27..64e52533 100644 --- a/Dockerfiles/work/Dockerfile-7.4 +++ b/Dockerfiles/work/Dockerfile-7.4 @@ -420,10 +420,6 @@ COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox ### ### Volumes ### -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 VOLUME /var/mail diff --git a/Dockerfiles/work/data/docker-entrypoint.d/40-mysqldump-secure.sh b/Dockerfiles/work/data/docker-entrypoint.d/400-mysqldump-secure.sh similarity index 100% rename from Dockerfiles/work/data/docker-entrypoint.d/40-mysqldump-secure.sh rename to Dockerfiles/work/data/docker-entrypoint.d/400-mysqldump-secure.sh diff --git a/Dockerfiles/work/data/docker-entrypoint.d/41-update-ca-certificates.sh b/Dockerfiles/work/data/docker-entrypoint.d/401-update-ca-certificates.sh similarity index 100% rename from Dockerfiles/work/data/docker-entrypoint.d/41-update-ca-certificates.sh rename to Dockerfiles/work/data/docker-entrypoint.d/401-update-ca-certificates.sh diff --git a/Dockerfiles/work/data/docker-entrypoint.sh b/Dockerfiles/work/data/docker-entrypoint.sh index afe08bd3..f1c1a49b 100755 --- a/Dockerfiles/work/data/docker-entrypoint.sh +++ b/Dockerfiles/work/data/docker-entrypoint.sh @@ -206,6 +206,12 @@ run "chmod 0755 /shared/httpd" "${DEBUG_LEVEL}" update_ca_certificates "/ca" "${DEBUG_LEVEL}" +### +### Run custom user supplied scripts +### +execute_custom_scripts "/startup.d" "${DEBUG_LEVEL}" + + ### ### Startup ### diff --git a/README.md b/README.md index 3a889f86..40e5b3d2 100644 --- a/README.md +++ b/README.md @@ -760,7 +760,7 @@ Have a look at the following table to see all offered volumes for each Docker im
/etc/php-custom.d
\*.ini
files in order to alter php behaviour./etc/php-modules.d
\*.so
files in order to add your php modules.\*.ini
file in order to actually load your custom provided module./startup.d
\*.sh
found in this directory will be executed during startup. This is useful to supply additional commands (such as installing custom software) when the container starts up./var/log/php
DOCKER_LOGS
to 0
, log files will be available under this directory.