diff --git a/.github/workflows/build_7_3-dev.yml b/.github/workflows/build_7_3-dev.yml index d0be842..7b76704 100644 --- a/.github/workflows/build_7_3-dev.yml +++ b/.github/workflows/build_7_3-dev.yml @@ -26,7 +26,7 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -39,8 +39,6 @@ jobs: file: ./7.3/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:dev-php-7.3 - diff --git a/.github/workflows/build_7_3-main.yml b/.github/workflows/build_7_3-main.yml index b605c31..deddb42 100644 --- a/.github/workflows/build_7_3-main.yml +++ b/.github/workflows/build_7_3-main.yml @@ -58,8 +58,6 @@ jobs: file: ./7.3/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:php-7.3 bcgdesign/nginx-php:php-7.3-${{ steps.version.outputs.content }} diff --git a/.github/workflows/build_7_4-dev.yml b/.github/workflows/build_7_4-dev.yml index 0681307..95da9af 100644 --- a/.github/workflows/build_7_4-dev.yml +++ b/.github/workflows/build_7_4-dev.yml @@ -39,8 +39,6 @@ jobs: file: ./7.4/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:dev-php-7 bcgdesign/nginx-php:dev-php-7.4 diff --git a/.github/workflows/build_7_4-main.yml b/.github/workflows/build_7_4-main.yml index ef39f9d..7bd7be3 100644 --- a/.github/workflows/build_7_4-main.yml +++ b/.github/workflows/build_7_4-main.yml @@ -58,8 +58,6 @@ jobs: file: ./7.4/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:latest bcgdesign/nginx-php:${{ steps.version.outputs.content }} diff --git a/.github/workflows/build_8_0-dev.yml b/.github/workflows/build_8_0-dev.yml index e12666c..90c98e3 100644 --- a/.github/workflows/build_8_0-dev.yml +++ b/.github/workflows/build_8_0-dev.yml @@ -39,8 +39,6 @@ jobs: file: ./8.0/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:dev bcgdesign/nginx-php:dev-php-8 diff --git a/.github/workflows/build_8_0-main.yml b/.github/workflows/build_8_0-main.yml index ddd88c6..abe1177 100644 --- a/.github/workflows/build_8_0-main.yml +++ b/.github/workflows/build_8_0-main.yml @@ -58,8 +58,6 @@ jobs: file: ./8.0/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:php-8 bcgdesign/nginx-php:php-8-${{ steps.version.outputs.content }} diff --git a/7.3/Dockerfile b/7.3/Dockerfile index ed00078..feafcd9 100644 --- a/7.3/Dockerfile +++ b/7.3/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.12-1.2.2 +FROM bcgdesign/nginx:alpine-3.12-1.3.0 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ @@ -10,6 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ + PHP_INI_ERROR_LOG="/var/log/php7/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/7.3/PHP_BUILD b/7.3/PHP_BUILD index fceaf5c..c839e12 100644 --- a/7.3/PHP_BUILD +++ b/7.3/PHP_BUILD @@ -1 +1 @@ -7.3.26-r0 \ No newline at end of file +7.3.27-r0 \ No newline at end of file diff --git a/7.3/PHP_REVISION b/7.3/PHP_REVISION index bd6fc59..b9ece44 100644 --- a/7.3/PHP_REVISION +++ b/7.3/PHP_REVISION @@ -1 +1 @@ -7.3.26 \ No newline at end of file +7.3.27 \ No newline at end of file diff --git a/7.3/php-fpm/run b/7.3/php-fpm/run index 33af069..ef6798a 100644 --- a/7.3/php-fpm/run +++ b/7.3/php-fpm/run @@ -1,3 +1,12 @@ #!/usr/bin/with-contenv bash -_echo "Starting PHP in FPM mode" + +set -euo pipefail + + +#====================================================================================================================== +# Start PHP FastCGI Process Manager +# -F run in foreground mode (allows S6 to supervise the service) +#====================================================================================================================== + +_echo "Starting PHP FastCGI Process Manager" php-fpm7 -F diff --git a/7.4/Dockerfile b/7.4/Dockerfile index 5310a27..b583819 100644 --- a/7.4/Dockerfile +++ b/7.4/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.13-1.2.2 +FROM bcgdesign/nginx:alpine-3.13-1.3.0 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ @@ -10,6 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ + PHP_INI_ERROR_LOG="/var/log/php7/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/7.4/php-fpm/run b/7.4/php-fpm/run index 33af069..ef6798a 100644 --- a/7.4/php-fpm/run +++ b/7.4/php-fpm/run @@ -1,3 +1,12 @@ #!/usr/bin/with-contenv bash -_echo "Starting PHP in FPM mode" + +set -euo pipefail + + +#====================================================================================================================== +# Start PHP FastCGI Process Manager +# -F run in foreground mode (allows S6 to supervise the service) +#====================================================================================================================== + +_echo "Starting PHP FastCGI Process Manager" php-fpm7 -F diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 986daba..89706b4 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.13-1.2.2 +FROM bcgdesign/nginx:alpine-3.13-1.3.0 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ @@ -10,6 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ + PHP_INI_ERROR_LOG="/var/log/php8/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/8.0/php-fpm/run b/8.0/php-fpm/run index 591156d..906bd93 100644 --- a/8.0/php-fpm/run +++ b/8.0/php-fpm/run @@ -1,3 +1,12 @@ #!/usr/bin/with-contenv bash -_echo "Starting PHP in FPM mode" + +set -euo pipefail + + +#====================================================================================================================== +# Start PHP FastCGI Process Manager +# -F run in foreground mode (allows S6 to supervise the service) +#====================================================================================================================== + +_echo "Starting PHP FastCGI Process Manager" php-fpm8 -F diff --git a/Dockerfile-automated b/Dockerfile-automated index e5a56d7..5488a37 100644 --- a/Dockerfile-automated +++ b/Dockerfile-automated @@ -10,6 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ + PHP_INI_ERROR_LOG="/var/log/php/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/VERSION b/VERSION index d2d61a7..589268e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2 \ No newline at end of file +1.3.0 \ No newline at end of file diff --git a/overlay/etc/cont-init.d/20-php-fpm-config b/overlay/etc/cont-init.d/20-php-fpm-config index cb92484..46cc7be 100644 --- a/overlay/etc/cont-init.d/20-php-fpm-config +++ b/overlay/etc/cont-init.d/20-php-fpm-config @@ -12,7 +12,7 @@ _echo "Setting www.conf configuration values..." declare -A VALUES VALUES["user"]="www" VALUES["group"]="www" -VALUES["log_level"]="${PHP_FPM_LOG_LEVEL}" +VALUES["log_level"]="${PHP_FPM_LOG_LEVEL-}" source /etc/functions/replace.sh replace VALUES "${PHP_DIR}/php-fpm.d/www.conf" diff --git a/overlay/etc/cont-init.d/21-php-ini-download b/overlay/etc/cont-init.d/21-php-ini-download index 98013bf..8046e09 100644 --- a/overlay/etc/cont-init.d/21-php-ini-download +++ b/overlay/etc/cont-init.d/21-php-ini-download @@ -4,7 +4,7 @@ set -euo pipefail #====================================================================================================================== -# Get php.ini +# Get php.ini #====================================================================================================================== DOWNLOADED="${PHP_DIR}/php.ini-${PHP_INI}.downloaded" @@ -14,9 +14,15 @@ if [ -e ${DOWNLOADED} ] ; then fi if [ "${PHP_INI}" = "development" ] || [ "${PHP_INI}" = "production" ] ; then + URL="https://raw.githubusercontent.com/php/php-src/master/php.ini-${PHP_INI}" _echo "Downloading php.ini from ${URL}..." wget -O "${PHP_DIR}/php.ini" ${URL} \ && touch ${DOWNLOADED} _done + +else + + _error "Unsupported PHP_INI value: '${PHP_INI}'." + fi diff --git a/overlay/etc/cont-init.d/22-php-ini-config b/overlay/etc/cont-init.d/22-php-ini-config index 7c7f941..1a421f9 100644 --- a/overlay/etc/cont-init.d/22-php-ini-config +++ b/overlay/etc/cont-init.d/22-php-ini-config @@ -10,13 +10,14 @@ set -euo pipefail _echo "Setting php.ini configuration values..." declare -A VALUES -VALUES["display_errors"]="${PHP_INI_DISPLAY_ERRORS}" -VALUES["display_startup_errors"]="${PHP_INI_DISPLAY_STARTUP_ERRORS}" -VALUES["error_reporting"]="${PHP_INI_ERROR_REPORTING}" -VALUES["memory_limit"]="${PHP_INI_MEMORY_LIMIT}" -VALUES["post_max_size"]="${PHP_INI_MAX_POST}" -VALUES["session.gc_maxlifetime"]="${PHP_SESSION_MAX_LIFETIME}" -VALUES["upload_max_filesize"]="${PHP_INI_MAX_UPLOAD}" +VALUES["display_errors"]="${PHP_INI_DISPLAY_ERRORS-}" +VALUES["display_startup_errors"]="${PHP_INI_DISPLAY_STARTUP_ERRORS-}" +VALUES["error_log"]="${PHP_INI_ERROR_LOG-}" +VALUES["error_reporting"]="${PHP_INI_ERROR_REPORTING-}" +VALUES["memory_limit"]="${PHP_INI_MEMORY_LIMIT-}" +VALUES["post_max_size"]="${PHP_INI_MAX_POST-}" +VALUES["session.gc_maxlifetime"]="${PHP_SESSION_MAX_LIFETIME-}" +VALUES["upload_max_filesize"]="${PHP_INI_MAX_UPLOAD-}" source /etc/functions/replace.sh replace VALUES "${PHP_DIR}/php.ini" diff --git a/overlay/etc/functions/replace.sh b/overlay/etc/functions/replace.sh index 35cd736..3ee7dd5 100644 --- a/overlay/etc/functions/replace.sh +++ b/overlay/etc/functions/replace.sh @@ -1,5 +1,13 @@ #!/bin/bash +#====================================================================================================================== +# Replace configuration values in a file. +# +# Arguments: +# 1 array of key/value pairs +# 2 path to the configuration file +#====================================================================================================================== + replace () { # get array and file diff --git a/overlay/etc/nginx/sites/localhost.conf b/overlay/etc/nginx/sites/localhost.conf index d8d1e78..70088f4 100644 --- a/overlay/etc/nginx/sites/localhost.conf +++ b/overlay/etc/nginx/sites/localhost.conf @@ -4,5 +4,6 @@ server { include helpers/nginx-error-pages.conf; include helpers/php-try-all.conf; include helpers/php-try-php.conf; + include helpers/ignore-favicon.conf; include helpers/static-files.conf; } \ No newline at end of file diff --git a/overlay/etc/periodic/hourly/php-clean-sessions b/overlay/etc/periodic/hourly/php-clean-sessions index 354a2e6..73a4912 100644 --- a/overlay/etc/periodic/hourly/php-clean-sessions +++ b/overlay/etc/periodic/hourly/php-clean-sessions @@ -1,2 +1,10 @@ #!/usr/bin/with-contenv bash + +set -euo pipefail + + +#====================================================================================================================== +# Call php-clean-sessions executable +#====================================================================================================================== + s6-setuidgid www php-clean-sessions diff --git a/overlay/etc/services.d/php-error-log/run b/overlay/etc/services.d/php-error-log/run new file mode 100644 index 0000000..19d724d --- /dev/null +++ b/overlay/etc/services.d/php-error-log/run @@ -0,0 +1,10 @@ +#!/usr/bin/with-contenv bash + +set -euo pipefail + + +#====================================================================================================================== +# Forward PHP errors to Docker +#====================================================================================================================== + +_forward "php-error-log" "${PHP_INI_ERROR_LOG}" diff --git a/overlay/etc/services.d/php-fpm/finish b/overlay/etc/services.d/php-fpm/finish index 1706b72..6b1e755 100644 --- a/overlay/etc/services.d/php-fpm/finish +++ b/overlay/etc/services.d/php-fpm/finish @@ -1,2 +1,10 @@ #!/usr/bin/with-contenv bash + +set -euo pipefail + + +#====================================================================================================================== +# Use base executable to terminate all services +#====================================================================================================================== + _terminate