diff --git a/.gitignore b/.gitignore index 9f11b75..7f993be 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea/ +*.swp diff --git a/2019.12/apache/Dockerfile b/2019.12/apache/Dockerfile index 655a7ad..a9134b4 100644 --- a/2019.12/apache/Dockerfile +++ b/2019.12/apache/Dockerfile @@ -11,9 +11,20 @@ RUN set -ex; \ git \ # For mail() support ssmtp \ +# For tini installation + gnupg dirmngr \ ; \ rm -rf /var/lib/apt/lists/*; +# Add tini for reaping processes +ENV TINI_VERSION v0.18.0 +RUN export BUILD_ARCH=$(dpkg-architecture --query DEB_BUILD_ARCH) \ + && curl -L -o /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH} \ + && curl -L -o /tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH}.asc \ + && gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --batch --verify /tini.asc /sbin/tini \ + && chmod +x /sbin/tini + # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ RUN set -ex; \ diff --git a/2019.12/apache/cron.sh b/2019.12/apache/cron.sh index c2fd1c2..55be04a 100755 --- a/2019.12/apache/cron.sh +++ b/2019.12/apache/cron.sh @@ -7,7 +7,7 @@ done echo "Waiting for MySQL $MYSQL_HOST initialization..." if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then - php /var/www/html/bin/daemon.php -f start + exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start else echo "[ERROR] Waited 300 seconds, no response" >&2 fi diff --git a/2019.12/fpm-alpine/Dockerfile b/2019.12/fpm-alpine/Dockerfile index 8a29480..5ac077b 100644 --- a/2019.12/fpm-alpine/Dockerfile +++ b/2019.12/fpm-alpine/Dockerfile @@ -8,7 +8,8 @@ RUN set -ex; \ git \ # For mail() support ssmtp \ - shadow; + shadow \ + tini; # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ diff --git a/2019.12/fpm-alpine/cron.sh b/2019.12/fpm-alpine/cron.sh index c2fd1c2..55be04a 100755 --- a/2019.12/fpm-alpine/cron.sh +++ b/2019.12/fpm-alpine/cron.sh @@ -7,7 +7,7 @@ done echo "Waiting for MySQL $MYSQL_HOST initialization..." if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then - php /var/www/html/bin/daemon.php -f start + exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start else echo "[ERROR] Waited 300 seconds, no response" >&2 fi diff --git a/2019.12/fpm/Dockerfile b/2019.12/fpm/Dockerfile index 3262ead..bf25cba 100644 --- a/2019.12/fpm/Dockerfile +++ b/2019.12/fpm/Dockerfile @@ -11,9 +11,20 @@ RUN set -ex; \ git \ # For mail() support ssmtp \ +# For tini installation + gnupg dirmngr \ ; \ rm -rf /var/lib/apt/lists/*; +# Add tini for reaping processes +ENV TINI_VERSION v0.18.0 +RUN export BUILD_ARCH=$(dpkg-architecture --query DEB_BUILD_ARCH) \ + && curl -L -o /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH} \ + && curl -L -o /tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH}.asc \ + && gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --batch --verify /tini.asc /sbin/tini \ + && chmod +x /sbin/tini + # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ RUN set -ex; \ diff --git a/2019.12/fpm/cron.sh b/2019.12/fpm/cron.sh index c2fd1c2..55be04a 100755 --- a/2019.12/fpm/cron.sh +++ b/2019.12/fpm/cron.sh @@ -7,7 +7,7 @@ done echo "Waiting for MySQL $MYSQL_HOST initialization..." if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then - php /var/www/html/bin/daemon.php -f start + exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start else echo "[ERROR] Waited 300 seconds, no response" >&2 fi diff --git a/2020.03-dev/apache/Dockerfile b/2020.03-dev/apache/Dockerfile index e52cfbd..127cea3 100644 --- a/2020.03-dev/apache/Dockerfile +++ b/2020.03-dev/apache/Dockerfile @@ -11,9 +11,20 @@ RUN set -ex; \ git \ # For mail() support ssmtp \ +# For tini installation + gnupg dirmngr \ ; \ rm -rf /var/lib/apt/lists/*; +# Add tini for reaping processes +ENV TINI_VERSION v0.18.0 +RUN export BUILD_ARCH=$(dpkg-architecture --query DEB_BUILD_ARCH) \ + && curl -L -o /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH} \ + && curl -L -o /tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH}.asc \ + && gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --batch --verify /tini.asc /sbin/tini \ + && chmod +x /sbin/tini + # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ RUN set -ex; \ diff --git a/2020.03-dev/apache/cron.sh b/2020.03-dev/apache/cron.sh index c2fd1c2..55be04a 100755 --- a/2020.03-dev/apache/cron.sh +++ b/2020.03-dev/apache/cron.sh @@ -7,7 +7,7 @@ done echo "Waiting for MySQL $MYSQL_HOST initialization..." if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then - php /var/www/html/bin/daemon.php -f start + exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start else echo "[ERROR] Waited 300 seconds, no response" >&2 fi diff --git a/2020.03-dev/fpm-alpine/Dockerfile b/2020.03-dev/fpm-alpine/Dockerfile index 6bf60ad..77c186d 100644 --- a/2020.03-dev/fpm-alpine/Dockerfile +++ b/2020.03-dev/fpm-alpine/Dockerfile @@ -8,7 +8,8 @@ RUN set -ex; \ git \ # For mail() support ssmtp \ - shadow; + shadow \ + tini; # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ diff --git a/2020.03-dev/fpm-alpine/cron.sh b/2020.03-dev/fpm-alpine/cron.sh index c2fd1c2..55be04a 100755 --- a/2020.03-dev/fpm-alpine/cron.sh +++ b/2020.03-dev/fpm-alpine/cron.sh @@ -7,7 +7,7 @@ done echo "Waiting for MySQL $MYSQL_HOST initialization..." if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then - php /var/www/html/bin/daemon.php -f start + exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start else echo "[ERROR] Waited 300 seconds, no response" >&2 fi diff --git a/2020.03-dev/fpm/Dockerfile b/2020.03-dev/fpm/Dockerfile index 7590942..cdfd485 100644 --- a/2020.03-dev/fpm/Dockerfile +++ b/2020.03-dev/fpm/Dockerfile @@ -11,9 +11,20 @@ RUN set -ex; \ git \ # For mail() support ssmtp \ +# For tini installation + gnupg dirmngr \ ; \ rm -rf /var/lib/apt/lists/*; +# Add tini for reaping processes +ENV TINI_VERSION v0.18.0 +RUN export BUILD_ARCH=$(dpkg-architecture --query DEB_BUILD_ARCH) \ + && curl -L -o /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH} \ + && curl -L -o /tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH}.asc \ + && gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --batch --verify /tini.asc /sbin/tini \ + && chmod +x /sbin/tini + # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ RUN set -ex; \ diff --git a/2020.03-dev/fpm/cron.sh b/2020.03-dev/fpm/cron.sh index c2fd1c2..55be04a 100755 --- a/2020.03-dev/fpm/cron.sh +++ b/2020.03-dev/fpm/cron.sh @@ -7,7 +7,7 @@ done echo "Waiting for MySQL $MYSQL_HOST initialization..." if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then - php /var/www/html/bin/daemon.php -f start + exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start else echo "[ERROR] Waited 300 seconds, no response" >&2 fi diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 4070d31..f2bb765 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -7,7 +7,8 @@ RUN set -ex; \ git \ # For mail() support ssmtp \ - shadow; + shadow \ + tini; # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 8d682e6..2828a03 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -10,9 +10,20 @@ RUN set -ex; \ git \ # For mail() support ssmtp \ +# For tini installation + gnupg dirmngr \ ; \ rm -rf /var/lib/apt/lists/*; +# Add tini for reaping processes +ENV TINI_VERSION v%%TINI_VERSION%% +RUN export BUILD_ARCH=$(dpkg-architecture --query DEB_BUILD_ARCH) \ + && curl -L -o /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH} \ + && curl -L -o /tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${BUILD_ARCH}.asc \ + && gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --batch --verify /tini.asc /sbin/tini \ + && chmod +x /sbin/tini + # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ RUN set -ex; \ diff --git a/docker-cron.sh b/docker-cron.sh index c2fd1c2..55be04a 100755 --- a/docker-cron.sh +++ b/docker-cron.sh @@ -7,7 +7,7 @@ done echo "Waiting for MySQL $MYSQL_HOST initialization..." if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then - php /var/www/html/bin/daemon.php -f start + exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start else echo "[ERROR] Waited 300 seconds, no response" >&2 fi diff --git a/update.sh b/update.sh index f11632d..a9a3c09 100755 --- a/update.sh +++ b/update.sh @@ -28,6 +28,16 @@ declare -A entrypoints=( [develop]='entrypoint-dev.sh' ) +# Only for debian variant +tini_version="$( + git ls-remote --tags https://github.com/krallin/tini.git \ + | cut -d/ -f3 \ + | grep -vE -- '.pre' \ + | sed -E 's/^v//' \ + | sort -V \ + | tail -1 +)" + apcu_version="$( git ls-remote --tags https://github.com/krakjoe/apcu.git \ | cut -d/ -f3 \ @@ -122,6 +132,7 @@ function create_variant() { s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g; s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g; s/%%ENTRYPOINT%%/'"${entrypoints[$install_type]}"'/g; + s/%%TINI_VERSION%%/'"${tini_version}"'/g; ' "$dir/Dockerfile" for name in entrypoint cron; do @@ -162,4 +173,4 @@ echo "$travisAmd64" > .travis.yml travisFull="$(awk -v 'RS=\n\n' '$1 == "-" && $2 == "stage:" && $3 == "test" && $4 == "images" && $5 == "(full)" { $0 = " - stage: test images (full)'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)" -echo "$travisFull" > .travis.yml \ No newline at end of file +echo "$travisFull" > .travis.yml