From 9805367fb85866f8a273a0c983f274e3be98638a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 30 Nov 2022 11:00:21 -0800 Subject: [PATCH] Remove EOL PHP 7.4 and update default version (conservatively) to 8.0 We're in a little bit of a weird place right now: PHP 7.4 is now EOL, but it's the only non-beta-support version of PHP supported by the latest release of WordPress (https://make.wordpress.org/hosting/handbook/server-environment/#php, https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/, https://core.trac.wordpress.org/ticket/57109#comment:3). For now, this opts to move our "default" version (for users who don't specify a version) to the conservative PHP 8.0 (the oldest still-supported "beta support" version). --- beta/php7.4/apache/Dockerfile | 168 ------------------ beta/php7.4/apache/docker-entrypoint.sh | 99 ----------- beta/php7.4/apache/wp-config-docker.php | 133 -------------- beta/php7.4/fpm-alpine/Dockerfile | 145 --------------- beta/php7.4/fpm-alpine/docker-entrypoint.sh | 99 ----------- beta/php7.4/fpm-alpine/wp-config-docker.php | 133 -------------- beta/php7.4/fpm/Dockerfile | 149 ---------------- beta/php7.4/fpm/docker-entrypoint.sh | 99 ----------- beta/php7.4/fpm/wp-config-docker.php | 133 -------------- cli/php7.4/alpine/Dockerfile | 130 -------------- cli/php7.4/alpine/docker-entrypoint.sh | 11 -- generate-stackbrew-library.sh | 4 +- latest/php7.4/apache/Dockerfile | 168 ------------------ latest/php7.4/apache/docker-entrypoint.sh | 99 ----------- latest/php7.4/apache/wp-config-docker.php | 133 -------------- latest/php7.4/fpm-alpine/Dockerfile | 145 --------------- latest/php7.4/fpm-alpine/docker-entrypoint.sh | 99 ----------- latest/php7.4/fpm-alpine/wp-config-docker.php | 133 -------------- latest/php7.4/fpm/Dockerfile | 149 ---------------- latest/php7.4/fpm/docker-entrypoint.sh | 99 ----------- latest/php7.4/fpm/wp-config-docker.php | 133 -------------- versions.json | 3 - versions.sh | 2 +- 23 files changed, 4 insertions(+), 2462 deletions(-) delete mode 100644 beta/php7.4/apache/Dockerfile delete mode 100755 beta/php7.4/apache/docker-entrypoint.sh delete mode 100644 beta/php7.4/apache/wp-config-docker.php delete mode 100644 beta/php7.4/fpm-alpine/Dockerfile delete mode 100755 beta/php7.4/fpm-alpine/docker-entrypoint.sh delete mode 100644 beta/php7.4/fpm-alpine/wp-config-docker.php delete mode 100644 beta/php7.4/fpm/Dockerfile delete mode 100755 beta/php7.4/fpm/docker-entrypoint.sh delete mode 100644 beta/php7.4/fpm/wp-config-docker.php delete mode 100644 cli/php7.4/alpine/Dockerfile delete mode 100755 cli/php7.4/alpine/docker-entrypoint.sh delete mode 100644 latest/php7.4/apache/Dockerfile delete mode 100755 latest/php7.4/apache/docker-entrypoint.sh delete mode 100644 latest/php7.4/apache/wp-config-docker.php delete mode 100644 latest/php7.4/fpm-alpine/Dockerfile delete mode 100755 latest/php7.4/fpm-alpine/docker-entrypoint.sh delete mode 100644 latest/php7.4/fpm-alpine/wp-config-docker.php delete mode 100644 latest/php7.4/fpm/Dockerfile delete mode 100755 latest/php7.4/fpm/docker-entrypoint.sh delete mode 100644 latest/php7.4/fpm/wp-config-docker.php diff --git a/beta/php7.4/apache/Dockerfile b/beta/php7.4/apache/Dockerfile deleted file mode 100644 index 48bc7f4e50..0000000000 --- a/beta/php7.4/apache/Dockerfile +++ /dev/null @@ -1,168 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM php:7.4-apache - -# persistent dependencies -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ -# Ghostscript is required for rendering PDF previews - ghostscript \ - ; \ - rm -rf /var/lib/apt/lists/* - -# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions) -RUN set -ex; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libfreetype6-dev \ - libicu-dev \ - libjpeg-dev \ - libmagickwand-dev \ - libpng-dev \ - libwebp-dev \ - libzip-dev \ - ; \ - \ - docker-php-ext-configure gd \ - --with-freetype \ - --with-jpeg \ - --with-webp \ - ; \ - docker-php-ext-install -j "$(nproc)" \ - bcmath \ - exif \ - gd \ - intl \ - mysqli \ - zip \ - ; \ -# https://pecl.php.net/package/imagick - pecl install imagick-3.6.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ - \ -# some misbehaving extensions end up outputting to stdout 🙈 (https://github.com/docker-library/wordpress/issues/669#issuecomment-993945967) - out="$(php -r 'exit(0);')"; \ - [ -z "$out" ]; \ - err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ]; \ - \ - extDir="$(php -r 'echo ini_get("extension_dir");')"; \ - [ -d "$extDir" ]; \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$extDir"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ - ! { ldd "$extDir"/*.so | grep 'not found'; }; \ -# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...) - err="$(php --version 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ] - -# set recommended PHP.ini settings -# see https://secure.php.net/manual/en/opcache.installation.php -RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - echo 'opcache.fast_shutdown=1'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini -# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging -RUN { \ -# https://www.php.net/manual/en/errorfunc.constants.php -# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670 - echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ - echo 'display_errors = Off'; \ - echo 'display_startup_errors = Off'; \ - echo 'log_errors = On'; \ - echo 'error_log = /dev/stderr'; \ - echo 'log_errors_max_len = 1024'; \ - echo 'ignore_repeated_errors = On'; \ - echo 'ignore_repeated_source = Off'; \ - echo 'html_errors = Off'; \ - } > /usr/local/etc/php/conf.d/error-logging.ini - -RUN set -eux; \ - a2enmod rewrite expires; \ - \ -# https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html - a2enmod remoteip; \ - { \ - echo 'RemoteIPHeader X-Forwarded-For'; \ -# these IP ranges are reserved for "private" use and should thus *usually* be safe inside Docker - echo 'RemoteIPTrustedProxy 10.0.0.0/8'; \ - echo 'RemoteIPTrustedProxy 172.16.0.0/12'; \ - echo 'RemoteIPTrustedProxy 192.168.0.0/16'; \ - echo 'RemoteIPTrustedProxy 169.254.0.0/16'; \ - echo 'RemoteIPTrustedProxy 127.0.0.0/8'; \ - } > /etc/apache2/conf-available/remoteip.conf; \ - a2enconf remoteip; \ -# https://github.com/docker-library/wordpress/issues/383#issuecomment-507886512 -# (replace all instances of "%h" with "%a" in LogFormat) - find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' + - -RUN set -eux; \ - version='6.1.1'; \ - sha1='80f0f829645dec07c68bcfe0a0a1e1d563992fcb'; \ - \ - curl -o wordpress.tar.gz -fL "https://wordpress.org/wordpress-$version.tar.gz"; \ - echo "$sha1 *wordpress.tar.gz" | sha1sum -c -; \ - \ -# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress - tar -xzf wordpress.tar.gz -C /usr/src/; \ - rm wordpress.tar.gz; \ - \ -# https://wordpress.org/support/article/htaccess/ - [ ! -e /usr/src/wordpress/.htaccess ]; \ - { \ - echo '# BEGIN WordPress'; \ - echo ''; \ - echo 'RewriteEngine On'; \ - echo 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]'; \ - echo 'RewriteBase /'; \ - echo 'RewriteRule ^index\.php$ - [L]'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-f'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-d'; \ - echo 'RewriteRule . /index.php [L]'; \ - echo ''; \ - echo '# END WordPress'; \ - } > /usr/src/wordpress/.htaccess; \ - \ - chown -R www-data:www-data /usr/src/wordpress; \ -# pre-create wp-content (and single-level children) for folks who want to bind-mount themes, etc so permissions are pre-created properly instead of root:root -# wp-content/cache: https://github.com/docker-library/wordpress/issues/534#issuecomment-705733507 - mkdir wp-content; \ - for dir in /usr/src/wordpress/wp-content/*/ cache; do \ - dir="$(basename "${dir%/}")"; \ - mkdir "wp-content/$dir"; \ - done; \ - chown -R www-data:www-data wp-content; \ - chmod -R 777 wp-content - -VOLUME /var/www/html - -COPY --chown=www-data:www-data wp-config-docker.php /usr/src/wordpress/ -COPY docker-entrypoint.sh /usr/local/bin/ - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["apache2-foreground"] diff --git a/beta/php7.4/apache/docker-entrypoint.sh b/beta/php7.4/apache/docker-entrypoint.sh deleted file mode 100755 index 1034f1dec1..0000000000 --- a/beta/php7.4/apache/docker-entrypoint.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then - uid="$(id -u)" - gid="$(id -g)" - if [ "$uid" = '0' ]; then - case "$1" in - apache2*) - user="${APACHE_RUN_USER:-www-data}" - group="${APACHE_RUN_GROUP:-www-data}" - - # strip off any '#' symbol ('#1000' is valid syntax for Apache) - pound='#' - user="${user#$pound}" - group="${group#$pound}" - ;; - *) # php-fpm - user='www-data' - group='www-data' - ;; - esac - else - user="$uid" - group="$gid" - fi - - if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then - # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) - if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then - chown "$user:$group" . - fi - - echo >&2 "WordPress not found in $PWD - copying now..." - if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then - echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" - fi - sourceTarArgs=( - --create - --file - - --directory /usr/src/wordpress - --owner "$user" --group "$group" - ) - targetTarArgs=( - --extract - --file - - ) - if [ "$uid" != '0' ]; then - # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" - targetTarArgs+=( --no-overwrite-dir ) - fi - # loop over "pluggable" content in the source, and if it already exists in the destination, skip it - # https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) - for contentPath in \ - /usr/src/wordpress/.htaccess \ - /usr/src/wordpress/wp-content/*/*/ \ - ; do - contentPath="${contentPath%/}" - [ -e "$contentPath" ] || continue - contentPath="${contentPath#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc. - if [ -e "$PWD/$contentPath" ]; then - echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" - sourceTarArgs+=( --exclude "./$contentPath" ) - fi - done - tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" - echo >&2 "Complete! WordPress has been successfully copied to $PWD" - fi - - wpEnvs=( "${!WORDPRESS_@}" ) - if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then - for wpConfigDocker in \ - wp-config-docker.php \ - /usr/src/wordpress/wp-config-docker.php \ - ; do - if [ -s "$wpConfigDocker" ]; then - echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" - # using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) - awk ' - /put your unique phrase here/ { - cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" - cmd | getline str - close(cmd) - gsub("put your unique phrase here", str) - } - { print } - ' "$wpConfigDocker" > wp-config.php - if [ "$uid" = '0' ]; then - # attempt to ensure that wp-config.php is owned by the run user - # could be on a filesystem that doesn't allow chown (like some NFS setups) - chown "$user:$group" wp-config.php || true - fi - break - fi - done - fi -fi - -exec "$@" diff --git a/beta/php7.4/apache/wp-config-docker.php b/beta/php7.4/apache/wp-config-docker.php deleted file mode 100644 index f62fc1f77a..0000000000 --- a/beta/php7.4/apache/wp-config-docker.php +++ /dev/null @@ -1,133 +0,0 @@ -&1 1>&2 2>&3)"; \ - [ -z "$err" ]; \ - \ - extDir="$(php -r 'echo ini_get("extension_dir");')"; \ - [ -d "$extDir" ]; \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive "$extDir" \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-network --virtual .wordpress-phpexts-rundeps $runDeps; \ - apk del --no-network .build-deps; \ - \ - ! { ldd "$extDir"/*.so | grep 'not found'; }; \ -# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...) - err="$(php --version 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ] - -# set recommended PHP.ini settings -# see https://secure.php.net/manual/en/opcache.installation.php -RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - echo 'opcache.fast_shutdown=1'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini -# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging -RUN { \ -# https://www.php.net/manual/en/errorfunc.constants.php -# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670 - echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ - echo 'display_errors = Off'; \ - echo 'display_startup_errors = Off'; \ - echo 'log_errors = On'; \ - echo 'error_log = /dev/stderr'; \ - echo 'log_errors_max_len = 1024'; \ - echo 'ignore_repeated_errors = On'; \ - echo 'ignore_repeated_source = Off'; \ - echo 'html_errors = Off'; \ - } > /usr/local/etc/php/conf.d/error-logging.ini - -RUN set -eux; \ - version='6.1.1'; \ - sha1='80f0f829645dec07c68bcfe0a0a1e1d563992fcb'; \ - \ - curl -o wordpress.tar.gz -fL "https://wordpress.org/wordpress-$version.tar.gz"; \ - echo "$sha1 *wordpress.tar.gz" | sha1sum -c -; \ - \ -# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress - tar -xzf wordpress.tar.gz -C /usr/src/; \ - rm wordpress.tar.gz; \ - \ -# https://wordpress.org/support/article/htaccess/ - [ ! -e /usr/src/wordpress/.htaccess ]; \ - { \ - echo '# BEGIN WordPress'; \ - echo ''; \ - echo 'RewriteEngine On'; \ - echo 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]'; \ - echo 'RewriteBase /'; \ - echo 'RewriteRule ^index\.php$ - [L]'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-f'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-d'; \ - echo 'RewriteRule . /index.php [L]'; \ - echo ''; \ - echo '# END WordPress'; \ - } > /usr/src/wordpress/.htaccess; \ - \ - chown -R www-data:www-data /usr/src/wordpress; \ -# pre-create wp-content (and single-level children) for folks who want to bind-mount themes, etc so permissions are pre-created properly instead of root:root -# wp-content/cache: https://github.com/docker-library/wordpress/issues/534#issuecomment-705733507 - mkdir wp-content; \ - for dir in /usr/src/wordpress/wp-content/*/ cache; do \ - dir="$(basename "${dir%/}")"; \ - mkdir "wp-content/$dir"; \ - done; \ - chown -R www-data:www-data wp-content; \ - chmod -R 777 wp-content - -VOLUME /var/www/html - -COPY --chown=www-data:www-data wp-config-docker.php /usr/src/wordpress/ -COPY docker-entrypoint.sh /usr/local/bin/ - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["php-fpm"] diff --git a/beta/php7.4/fpm-alpine/docker-entrypoint.sh b/beta/php7.4/fpm-alpine/docker-entrypoint.sh deleted file mode 100755 index 1034f1dec1..0000000000 --- a/beta/php7.4/fpm-alpine/docker-entrypoint.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then - uid="$(id -u)" - gid="$(id -g)" - if [ "$uid" = '0' ]; then - case "$1" in - apache2*) - user="${APACHE_RUN_USER:-www-data}" - group="${APACHE_RUN_GROUP:-www-data}" - - # strip off any '#' symbol ('#1000' is valid syntax for Apache) - pound='#' - user="${user#$pound}" - group="${group#$pound}" - ;; - *) # php-fpm - user='www-data' - group='www-data' - ;; - esac - else - user="$uid" - group="$gid" - fi - - if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then - # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) - if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then - chown "$user:$group" . - fi - - echo >&2 "WordPress not found in $PWD - copying now..." - if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then - echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" - fi - sourceTarArgs=( - --create - --file - - --directory /usr/src/wordpress - --owner "$user" --group "$group" - ) - targetTarArgs=( - --extract - --file - - ) - if [ "$uid" != '0' ]; then - # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" - targetTarArgs+=( --no-overwrite-dir ) - fi - # loop over "pluggable" content in the source, and if it already exists in the destination, skip it - # https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) - for contentPath in \ - /usr/src/wordpress/.htaccess \ - /usr/src/wordpress/wp-content/*/*/ \ - ; do - contentPath="${contentPath%/}" - [ -e "$contentPath" ] || continue - contentPath="${contentPath#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc. - if [ -e "$PWD/$contentPath" ]; then - echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" - sourceTarArgs+=( --exclude "./$contentPath" ) - fi - done - tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" - echo >&2 "Complete! WordPress has been successfully copied to $PWD" - fi - - wpEnvs=( "${!WORDPRESS_@}" ) - if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then - for wpConfigDocker in \ - wp-config-docker.php \ - /usr/src/wordpress/wp-config-docker.php \ - ; do - if [ -s "$wpConfigDocker" ]; then - echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" - # using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) - awk ' - /put your unique phrase here/ { - cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" - cmd | getline str - close(cmd) - gsub("put your unique phrase here", str) - } - { print } - ' "$wpConfigDocker" > wp-config.php - if [ "$uid" = '0' ]; then - # attempt to ensure that wp-config.php is owned by the run user - # could be on a filesystem that doesn't allow chown (like some NFS setups) - chown "$user:$group" wp-config.php || true - fi - break - fi - done - fi -fi - -exec "$@" diff --git a/beta/php7.4/fpm-alpine/wp-config-docker.php b/beta/php7.4/fpm-alpine/wp-config-docker.php deleted file mode 100644 index f62fc1f77a..0000000000 --- a/beta/php7.4/fpm-alpine/wp-config-docker.php +++ /dev/null @@ -1,133 +0,0 @@ -&1 1>&2 2>&3)"; \ - [ -z "$err" ]; \ - \ - extDir="$(php -r 'echo ini_get("extension_dir");')"; \ - [ -d "$extDir" ]; \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$extDir"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ - ! { ldd "$extDir"/*.so | grep 'not found'; }; \ -# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...) - err="$(php --version 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ] - -# set recommended PHP.ini settings -# see https://secure.php.net/manual/en/opcache.installation.php -RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - echo 'opcache.fast_shutdown=1'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini -# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging -RUN { \ -# https://www.php.net/manual/en/errorfunc.constants.php -# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670 - echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ - echo 'display_errors = Off'; \ - echo 'display_startup_errors = Off'; \ - echo 'log_errors = On'; \ - echo 'error_log = /dev/stderr'; \ - echo 'log_errors_max_len = 1024'; \ - echo 'ignore_repeated_errors = On'; \ - echo 'ignore_repeated_source = Off'; \ - echo 'html_errors = Off'; \ - } > /usr/local/etc/php/conf.d/error-logging.ini - -RUN set -eux; \ - version='6.1.1'; \ - sha1='80f0f829645dec07c68bcfe0a0a1e1d563992fcb'; \ - \ - curl -o wordpress.tar.gz -fL "https://wordpress.org/wordpress-$version.tar.gz"; \ - echo "$sha1 *wordpress.tar.gz" | sha1sum -c -; \ - \ -# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress - tar -xzf wordpress.tar.gz -C /usr/src/; \ - rm wordpress.tar.gz; \ - \ -# https://wordpress.org/support/article/htaccess/ - [ ! -e /usr/src/wordpress/.htaccess ]; \ - { \ - echo '# BEGIN WordPress'; \ - echo ''; \ - echo 'RewriteEngine On'; \ - echo 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]'; \ - echo 'RewriteBase /'; \ - echo 'RewriteRule ^index\.php$ - [L]'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-f'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-d'; \ - echo 'RewriteRule . /index.php [L]'; \ - echo ''; \ - echo '# END WordPress'; \ - } > /usr/src/wordpress/.htaccess; \ - \ - chown -R www-data:www-data /usr/src/wordpress; \ -# pre-create wp-content (and single-level children) for folks who want to bind-mount themes, etc so permissions are pre-created properly instead of root:root -# wp-content/cache: https://github.com/docker-library/wordpress/issues/534#issuecomment-705733507 - mkdir wp-content; \ - for dir in /usr/src/wordpress/wp-content/*/ cache; do \ - dir="$(basename "${dir%/}")"; \ - mkdir "wp-content/$dir"; \ - done; \ - chown -R www-data:www-data wp-content; \ - chmod -R 777 wp-content - -VOLUME /var/www/html - -COPY --chown=www-data:www-data wp-config-docker.php /usr/src/wordpress/ -COPY docker-entrypoint.sh /usr/local/bin/ - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["php-fpm"] diff --git a/beta/php7.4/fpm/docker-entrypoint.sh b/beta/php7.4/fpm/docker-entrypoint.sh deleted file mode 100755 index 1034f1dec1..0000000000 --- a/beta/php7.4/fpm/docker-entrypoint.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then - uid="$(id -u)" - gid="$(id -g)" - if [ "$uid" = '0' ]; then - case "$1" in - apache2*) - user="${APACHE_RUN_USER:-www-data}" - group="${APACHE_RUN_GROUP:-www-data}" - - # strip off any '#' symbol ('#1000' is valid syntax for Apache) - pound='#' - user="${user#$pound}" - group="${group#$pound}" - ;; - *) # php-fpm - user='www-data' - group='www-data' - ;; - esac - else - user="$uid" - group="$gid" - fi - - if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then - # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) - if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then - chown "$user:$group" . - fi - - echo >&2 "WordPress not found in $PWD - copying now..." - if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then - echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" - fi - sourceTarArgs=( - --create - --file - - --directory /usr/src/wordpress - --owner "$user" --group "$group" - ) - targetTarArgs=( - --extract - --file - - ) - if [ "$uid" != '0' ]; then - # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" - targetTarArgs+=( --no-overwrite-dir ) - fi - # loop over "pluggable" content in the source, and if it already exists in the destination, skip it - # https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) - for contentPath in \ - /usr/src/wordpress/.htaccess \ - /usr/src/wordpress/wp-content/*/*/ \ - ; do - contentPath="${contentPath%/}" - [ -e "$contentPath" ] || continue - contentPath="${contentPath#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc. - if [ -e "$PWD/$contentPath" ]; then - echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" - sourceTarArgs+=( --exclude "./$contentPath" ) - fi - done - tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" - echo >&2 "Complete! WordPress has been successfully copied to $PWD" - fi - - wpEnvs=( "${!WORDPRESS_@}" ) - if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then - for wpConfigDocker in \ - wp-config-docker.php \ - /usr/src/wordpress/wp-config-docker.php \ - ; do - if [ -s "$wpConfigDocker" ]; then - echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" - # using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) - awk ' - /put your unique phrase here/ { - cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" - cmd | getline str - close(cmd) - gsub("put your unique phrase here", str) - } - { print } - ' "$wpConfigDocker" > wp-config.php - if [ "$uid" = '0' ]; then - # attempt to ensure that wp-config.php is owned by the run user - # could be on a filesystem that doesn't allow chown (like some NFS setups) - chown "$user:$group" wp-config.php || true - fi - break - fi - done - fi -fi - -exec "$@" diff --git a/beta/php7.4/fpm/wp-config-docker.php b/beta/php7.4/fpm/wp-config-docker.php deleted file mode 100644 index f62fc1f77a..0000000000 --- a/beta/php7.4/fpm/wp-config-docker.php +++ /dev/null @@ -1,133 +0,0 @@ -&1 1>&2 2>&3)"; \ - [ -z "$err" ]; \ - \ - extDir="$(php -r 'echo ini_get("extension_dir");')"; \ - [ -d "$extDir" ]; \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive "$extDir" \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-network --virtual .wordpress-phpexts-rundeps $runDeps; \ - apk del --no-network .build-deps; \ - \ - ! { ldd "$extDir"/*.so | grep 'not found'; }; \ -# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...) - err="$(php --version 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ] - -# set recommended PHP.ini settings -# excluding opcache due https://github.com/docker-library/wordpress/issues/407 -# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging -RUN { \ -# https://www.php.net/manual/en/errorfunc.constants.php -# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670 - echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ - echo 'display_errors = Off'; \ - echo 'display_startup_errors = Off'; \ - echo 'log_errors = On'; \ - echo 'error_log = /dev/stderr'; \ - echo 'log_errors_max_len = 1024'; \ - echo 'ignore_repeated_errors = On'; \ - echo 'ignore_repeated_source = Off'; \ - echo 'html_errors = Off'; \ - } > /usr/local/etc/php/conf.d/error-logging.ini - -# https://make.wordpress.org/cli/2018/05/31/gpg-signature-change/ -# pub rsa2048 2018-05-31 [SC] -# 63AF 7AA1 5067 C056 16FD DD88 A3A2 E8F2 26F0 BC06 -# uid [ unknown] WP-CLI Releases -# sub rsa2048 2018-05-31 [E] -ENV WORDPRESS_CLI_GPG_KEY 63AF7AA15067C05616FDDD88A3A2E8F226F0BC06 - -ENV WORDPRESS_CLI_VERSION 2.7.1 -ENV WORDPRESS_CLI_SHA512 956b5e3e1a076bd5441c082ee754e3ff4517ec965b93c621f455c2bf5719358c36e67d52f676492700b59d42cacb34a50d382535c035f19da7a0b98bc41860de - -RUN set -ex; \ - \ - apk add --no-cache --virtual .fetch-deps \ - gnupg \ - ; \ - \ - curl -o /usr/local/bin/wp.gpg -fL "https://github.com/wp-cli/wp-cli/releases/download/v${WORDPRESS_CLI_VERSION}/wp-cli-${WORDPRESS_CLI_VERSION}.phar.gpg"; \ - \ - GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$WORDPRESS_CLI_GPG_KEY"; \ - gpg --batch --decrypt --output /usr/local/bin/wp /usr/local/bin/wp.gpg; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME" /usr/local/bin/wp.gpg; unset GNUPGHOME; \ - \ - echo "$WORDPRESS_CLI_SHA512 */usr/local/bin/wp" | sha512sum -c -; \ - chmod +x /usr/local/bin/wp; \ - \ - apk del --no-network .fetch-deps; \ - \ - wp --allow-root --version - -VOLUME /var/www/html - -COPY docker-entrypoint.sh /usr/local/bin/ - -ENTRYPOINT ["docker-entrypoint.sh"] -USER www-data -CMD ["wp", "shell"] diff --git a/cli/php7.4/alpine/docker-entrypoint.sh b/cli/php7.4/alpine/docker-entrypoint.sh deleted file mode 100755 index b0f77dbb63..0000000000 --- a/cli/php7.4/alpine/docker-entrypoint.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -set -euo pipefail - -# first arg is `-f` or `--some-option` -# or if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead -# (this allows for "docker run wordpress:cli help", etc) -if [ "${1#-}" != "$1" ] || wp help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi - -exec "$@" diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 8ca2c547a4..3722751963 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -2,8 +2,10 @@ set -Eeuo pipefail # https://wordpress.org/about/requirements/ +# https://make.wordpress.org/hosting/handbook/server-environment/#php # https://wordpress.org/support/update-php/#before-you-update-your-php-version -defaultPhpVersion='php7.4' +# https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ +defaultPhpVersion='php8.0' defaultVariant='apache' self="$(basename "$BASH_SOURCE")" diff --git a/latest/php7.4/apache/Dockerfile b/latest/php7.4/apache/Dockerfile deleted file mode 100644 index 48bc7f4e50..0000000000 --- a/latest/php7.4/apache/Dockerfile +++ /dev/null @@ -1,168 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM php:7.4-apache - -# persistent dependencies -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ -# Ghostscript is required for rendering PDF previews - ghostscript \ - ; \ - rm -rf /var/lib/apt/lists/* - -# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions) -RUN set -ex; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libfreetype6-dev \ - libicu-dev \ - libjpeg-dev \ - libmagickwand-dev \ - libpng-dev \ - libwebp-dev \ - libzip-dev \ - ; \ - \ - docker-php-ext-configure gd \ - --with-freetype \ - --with-jpeg \ - --with-webp \ - ; \ - docker-php-ext-install -j "$(nproc)" \ - bcmath \ - exif \ - gd \ - intl \ - mysqli \ - zip \ - ; \ -# https://pecl.php.net/package/imagick - pecl install imagick-3.6.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ - \ -# some misbehaving extensions end up outputting to stdout 🙈 (https://github.com/docker-library/wordpress/issues/669#issuecomment-993945967) - out="$(php -r 'exit(0);')"; \ - [ -z "$out" ]; \ - err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ]; \ - \ - extDir="$(php -r 'echo ini_get("extension_dir");')"; \ - [ -d "$extDir" ]; \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$extDir"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ - ! { ldd "$extDir"/*.so | grep 'not found'; }; \ -# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...) - err="$(php --version 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ] - -# set recommended PHP.ini settings -# see https://secure.php.net/manual/en/opcache.installation.php -RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - echo 'opcache.fast_shutdown=1'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini -# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging -RUN { \ -# https://www.php.net/manual/en/errorfunc.constants.php -# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670 - echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ - echo 'display_errors = Off'; \ - echo 'display_startup_errors = Off'; \ - echo 'log_errors = On'; \ - echo 'error_log = /dev/stderr'; \ - echo 'log_errors_max_len = 1024'; \ - echo 'ignore_repeated_errors = On'; \ - echo 'ignore_repeated_source = Off'; \ - echo 'html_errors = Off'; \ - } > /usr/local/etc/php/conf.d/error-logging.ini - -RUN set -eux; \ - a2enmod rewrite expires; \ - \ -# https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html - a2enmod remoteip; \ - { \ - echo 'RemoteIPHeader X-Forwarded-For'; \ -# these IP ranges are reserved for "private" use and should thus *usually* be safe inside Docker - echo 'RemoteIPTrustedProxy 10.0.0.0/8'; \ - echo 'RemoteIPTrustedProxy 172.16.0.0/12'; \ - echo 'RemoteIPTrustedProxy 192.168.0.0/16'; \ - echo 'RemoteIPTrustedProxy 169.254.0.0/16'; \ - echo 'RemoteIPTrustedProxy 127.0.0.0/8'; \ - } > /etc/apache2/conf-available/remoteip.conf; \ - a2enconf remoteip; \ -# https://github.com/docker-library/wordpress/issues/383#issuecomment-507886512 -# (replace all instances of "%h" with "%a" in LogFormat) - find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' + - -RUN set -eux; \ - version='6.1.1'; \ - sha1='80f0f829645dec07c68bcfe0a0a1e1d563992fcb'; \ - \ - curl -o wordpress.tar.gz -fL "https://wordpress.org/wordpress-$version.tar.gz"; \ - echo "$sha1 *wordpress.tar.gz" | sha1sum -c -; \ - \ -# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress - tar -xzf wordpress.tar.gz -C /usr/src/; \ - rm wordpress.tar.gz; \ - \ -# https://wordpress.org/support/article/htaccess/ - [ ! -e /usr/src/wordpress/.htaccess ]; \ - { \ - echo '# BEGIN WordPress'; \ - echo ''; \ - echo 'RewriteEngine On'; \ - echo 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]'; \ - echo 'RewriteBase /'; \ - echo 'RewriteRule ^index\.php$ - [L]'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-f'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-d'; \ - echo 'RewriteRule . /index.php [L]'; \ - echo ''; \ - echo '# END WordPress'; \ - } > /usr/src/wordpress/.htaccess; \ - \ - chown -R www-data:www-data /usr/src/wordpress; \ -# pre-create wp-content (and single-level children) for folks who want to bind-mount themes, etc so permissions are pre-created properly instead of root:root -# wp-content/cache: https://github.com/docker-library/wordpress/issues/534#issuecomment-705733507 - mkdir wp-content; \ - for dir in /usr/src/wordpress/wp-content/*/ cache; do \ - dir="$(basename "${dir%/}")"; \ - mkdir "wp-content/$dir"; \ - done; \ - chown -R www-data:www-data wp-content; \ - chmod -R 777 wp-content - -VOLUME /var/www/html - -COPY --chown=www-data:www-data wp-config-docker.php /usr/src/wordpress/ -COPY docker-entrypoint.sh /usr/local/bin/ - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["apache2-foreground"] diff --git a/latest/php7.4/apache/docker-entrypoint.sh b/latest/php7.4/apache/docker-entrypoint.sh deleted file mode 100755 index 1034f1dec1..0000000000 --- a/latest/php7.4/apache/docker-entrypoint.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then - uid="$(id -u)" - gid="$(id -g)" - if [ "$uid" = '0' ]; then - case "$1" in - apache2*) - user="${APACHE_RUN_USER:-www-data}" - group="${APACHE_RUN_GROUP:-www-data}" - - # strip off any '#' symbol ('#1000' is valid syntax for Apache) - pound='#' - user="${user#$pound}" - group="${group#$pound}" - ;; - *) # php-fpm - user='www-data' - group='www-data' - ;; - esac - else - user="$uid" - group="$gid" - fi - - if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then - # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) - if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then - chown "$user:$group" . - fi - - echo >&2 "WordPress not found in $PWD - copying now..." - if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then - echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" - fi - sourceTarArgs=( - --create - --file - - --directory /usr/src/wordpress - --owner "$user" --group "$group" - ) - targetTarArgs=( - --extract - --file - - ) - if [ "$uid" != '0' ]; then - # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" - targetTarArgs+=( --no-overwrite-dir ) - fi - # loop over "pluggable" content in the source, and if it already exists in the destination, skip it - # https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) - for contentPath in \ - /usr/src/wordpress/.htaccess \ - /usr/src/wordpress/wp-content/*/*/ \ - ; do - contentPath="${contentPath%/}" - [ -e "$contentPath" ] || continue - contentPath="${contentPath#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc. - if [ -e "$PWD/$contentPath" ]; then - echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" - sourceTarArgs+=( --exclude "./$contentPath" ) - fi - done - tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" - echo >&2 "Complete! WordPress has been successfully copied to $PWD" - fi - - wpEnvs=( "${!WORDPRESS_@}" ) - if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then - for wpConfigDocker in \ - wp-config-docker.php \ - /usr/src/wordpress/wp-config-docker.php \ - ; do - if [ -s "$wpConfigDocker" ]; then - echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" - # using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) - awk ' - /put your unique phrase here/ { - cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" - cmd | getline str - close(cmd) - gsub("put your unique phrase here", str) - } - { print } - ' "$wpConfigDocker" > wp-config.php - if [ "$uid" = '0' ]; then - # attempt to ensure that wp-config.php is owned by the run user - # could be on a filesystem that doesn't allow chown (like some NFS setups) - chown "$user:$group" wp-config.php || true - fi - break - fi - done - fi -fi - -exec "$@" diff --git a/latest/php7.4/apache/wp-config-docker.php b/latest/php7.4/apache/wp-config-docker.php deleted file mode 100644 index f62fc1f77a..0000000000 --- a/latest/php7.4/apache/wp-config-docker.php +++ /dev/null @@ -1,133 +0,0 @@ -&1 1>&2 2>&3)"; \ - [ -z "$err" ]; \ - \ - extDir="$(php -r 'echo ini_get("extension_dir");')"; \ - [ -d "$extDir" ]; \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive "$extDir" \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-network --virtual .wordpress-phpexts-rundeps $runDeps; \ - apk del --no-network .build-deps; \ - \ - ! { ldd "$extDir"/*.so | grep 'not found'; }; \ -# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...) - err="$(php --version 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ] - -# set recommended PHP.ini settings -# see https://secure.php.net/manual/en/opcache.installation.php -RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - echo 'opcache.fast_shutdown=1'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini -# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging -RUN { \ -# https://www.php.net/manual/en/errorfunc.constants.php -# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670 - echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ - echo 'display_errors = Off'; \ - echo 'display_startup_errors = Off'; \ - echo 'log_errors = On'; \ - echo 'error_log = /dev/stderr'; \ - echo 'log_errors_max_len = 1024'; \ - echo 'ignore_repeated_errors = On'; \ - echo 'ignore_repeated_source = Off'; \ - echo 'html_errors = Off'; \ - } > /usr/local/etc/php/conf.d/error-logging.ini - -RUN set -eux; \ - version='6.1.1'; \ - sha1='80f0f829645dec07c68bcfe0a0a1e1d563992fcb'; \ - \ - curl -o wordpress.tar.gz -fL "https://wordpress.org/wordpress-$version.tar.gz"; \ - echo "$sha1 *wordpress.tar.gz" | sha1sum -c -; \ - \ -# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress - tar -xzf wordpress.tar.gz -C /usr/src/; \ - rm wordpress.tar.gz; \ - \ -# https://wordpress.org/support/article/htaccess/ - [ ! -e /usr/src/wordpress/.htaccess ]; \ - { \ - echo '# BEGIN WordPress'; \ - echo ''; \ - echo 'RewriteEngine On'; \ - echo 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]'; \ - echo 'RewriteBase /'; \ - echo 'RewriteRule ^index\.php$ - [L]'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-f'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-d'; \ - echo 'RewriteRule . /index.php [L]'; \ - echo ''; \ - echo '# END WordPress'; \ - } > /usr/src/wordpress/.htaccess; \ - \ - chown -R www-data:www-data /usr/src/wordpress; \ -# pre-create wp-content (and single-level children) for folks who want to bind-mount themes, etc so permissions are pre-created properly instead of root:root -# wp-content/cache: https://github.com/docker-library/wordpress/issues/534#issuecomment-705733507 - mkdir wp-content; \ - for dir in /usr/src/wordpress/wp-content/*/ cache; do \ - dir="$(basename "${dir%/}")"; \ - mkdir "wp-content/$dir"; \ - done; \ - chown -R www-data:www-data wp-content; \ - chmod -R 777 wp-content - -VOLUME /var/www/html - -COPY --chown=www-data:www-data wp-config-docker.php /usr/src/wordpress/ -COPY docker-entrypoint.sh /usr/local/bin/ - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["php-fpm"] diff --git a/latest/php7.4/fpm-alpine/docker-entrypoint.sh b/latest/php7.4/fpm-alpine/docker-entrypoint.sh deleted file mode 100755 index 1034f1dec1..0000000000 --- a/latest/php7.4/fpm-alpine/docker-entrypoint.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then - uid="$(id -u)" - gid="$(id -g)" - if [ "$uid" = '0' ]; then - case "$1" in - apache2*) - user="${APACHE_RUN_USER:-www-data}" - group="${APACHE_RUN_GROUP:-www-data}" - - # strip off any '#' symbol ('#1000' is valid syntax for Apache) - pound='#' - user="${user#$pound}" - group="${group#$pound}" - ;; - *) # php-fpm - user='www-data' - group='www-data' - ;; - esac - else - user="$uid" - group="$gid" - fi - - if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then - # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) - if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then - chown "$user:$group" . - fi - - echo >&2 "WordPress not found in $PWD - copying now..." - if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then - echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" - fi - sourceTarArgs=( - --create - --file - - --directory /usr/src/wordpress - --owner "$user" --group "$group" - ) - targetTarArgs=( - --extract - --file - - ) - if [ "$uid" != '0' ]; then - # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" - targetTarArgs+=( --no-overwrite-dir ) - fi - # loop over "pluggable" content in the source, and if it already exists in the destination, skip it - # https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) - for contentPath in \ - /usr/src/wordpress/.htaccess \ - /usr/src/wordpress/wp-content/*/*/ \ - ; do - contentPath="${contentPath%/}" - [ -e "$contentPath" ] || continue - contentPath="${contentPath#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc. - if [ -e "$PWD/$contentPath" ]; then - echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" - sourceTarArgs+=( --exclude "./$contentPath" ) - fi - done - tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" - echo >&2 "Complete! WordPress has been successfully copied to $PWD" - fi - - wpEnvs=( "${!WORDPRESS_@}" ) - if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then - for wpConfigDocker in \ - wp-config-docker.php \ - /usr/src/wordpress/wp-config-docker.php \ - ; do - if [ -s "$wpConfigDocker" ]; then - echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" - # using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) - awk ' - /put your unique phrase here/ { - cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" - cmd | getline str - close(cmd) - gsub("put your unique phrase here", str) - } - { print } - ' "$wpConfigDocker" > wp-config.php - if [ "$uid" = '0' ]; then - # attempt to ensure that wp-config.php is owned by the run user - # could be on a filesystem that doesn't allow chown (like some NFS setups) - chown "$user:$group" wp-config.php || true - fi - break - fi - done - fi -fi - -exec "$@" diff --git a/latest/php7.4/fpm-alpine/wp-config-docker.php b/latest/php7.4/fpm-alpine/wp-config-docker.php deleted file mode 100644 index f62fc1f77a..0000000000 --- a/latest/php7.4/fpm-alpine/wp-config-docker.php +++ /dev/null @@ -1,133 +0,0 @@ -&1 1>&2 2>&3)"; \ - [ -z "$err" ]; \ - \ - extDir="$(php -r 'echo ini_get("extension_dir");')"; \ - [ -d "$extDir" ]; \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$extDir"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ - ! { ldd "$extDir"/*.so | grep 'not found'; }; \ -# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...) - err="$(php --version 3>&1 1>&2 2>&3)"; \ - [ -z "$err" ] - -# set recommended PHP.ini settings -# see https://secure.php.net/manual/en/opcache.installation.php -RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - echo 'opcache.fast_shutdown=1'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini -# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging -RUN { \ -# https://www.php.net/manual/en/errorfunc.constants.php -# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670 - echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ - echo 'display_errors = Off'; \ - echo 'display_startup_errors = Off'; \ - echo 'log_errors = On'; \ - echo 'error_log = /dev/stderr'; \ - echo 'log_errors_max_len = 1024'; \ - echo 'ignore_repeated_errors = On'; \ - echo 'ignore_repeated_source = Off'; \ - echo 'html_errors = Off'; \ - } > /usr/local/etc/php/conf.d/error-logging.ini - -RUN set -eux; \ - version='6.1.1'; \ - sha1='80f0f829645dec07c68bcfe0a0a1e1d563992fcb'; \ - \ - curl -o wordpress.tar.gz -fL "https://wordpress.org/wordpress-$version.tar.gz"; \ - echo "$sha1 *wordpress.tar.gz" | sha1sum -c -; \ - \ -# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress - tar -xzf wordpress.tar.gz -C /usr/src/; \ - rm wordpress.tar.gz; \ - \ -# https://wordpress.org/support/article/htaccess/ - [ ! -e /usr/src/wordpress/.htaccess ]; \ - { \ - echo '# BEGIN WordPress'; \ - echo ''; \ - echo 'RewriteEngine On'; \ - echo 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]'; \ - echo 'RewriteBase /'; \ - echo 'RewriteRule ^index\.php$ - [L]'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-f'; \ - echo 'RewriteCond %{REQUEST_FILENAME} !-d'; \ - echo 'RewriteRule . /index.php [L]'; \ - echo ''; \ - echo '# END WordPress'; \ - } > /usr/src/wordpress/.htaccess; \ - \ - chown -R www-data:www-data /usr/src/wordpress; \ -# pre-create wp-content (and single-level children) for folks who want to bind-mount themes, etc so permissions are pre-created properly instead of root:root -# wp-content/cache: https://github.com/docker-library/wordpress/issues/534#issuecomment-705733507 - mkdir wp-content; \ - for dir in /usr/src/wordpress/wp-content/*/ cache; do \ - dir="$(basename "${dir%/}")"; \ - mkdir "wp-content/$dir"; \ - done; \ - chown -R www-data:www-data wp-content; \ - chmod -R 777 wp-content - -VOLUME /var/www/html - -COPY --chown=www-data:www-data wp-config-docker.php /usr/src/wordpress/ -COPY docker-entrypoint.sh /usr/local/bin/ - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["php-fpm"] diff --git a/latest/php7.4/fpm/docker-entrypoint.sh b/latest/php7.4/fpm/docker-entrypoint.sh deleted file mode 100755 index 1034f1dec1..0000000000 --- a/latest/php7.4/fpm/docker-entrypoint.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then - uid="$(id -u)" - gid="$(id -g)" - if [ "$uid" = '0' ]; then - case "$1" in - apache2*) - user="${APACHE_RUN_USER:-www-data}" - group="${APACHE_RUN_GROUP:-www-data}" - - # strip off any '#' symbol ('#1000' is valid syntax for Apache) - pound='#' - user="${user#$pound}" - group="${group#$pound}" - ;; - *) # php-fpm - user='www-data' - group='www-data' - ;; - esac - else - user="$uid" - group="$gid" - fi - - if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then - # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) - if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then - chown "$user:$group" . - fi - - echo >&2 "WordPress not found in $PWD - copying now..." - if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then - echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" - fi - sourceTarArgs=( - --create - --file - - --directory /usr/src/wordpress - --owner "$user" --group "$group" - ) - targetTarArgs=( - --extract - --file - - ) - if [ "$uid" != '0' ]; then - # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" - targetTarArgs+=( --no-overwrite-dir ) - fi - # loop over "pluggable" content in the source, and if it already exists in the destination, skip it - # https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) - for contentPath in \ - /usr/src/wordpress/.htaccess \ - /usr/src/wordpress/wp-content/*/*/ \ - ; do - contentPath="${contentPath%/}" - [ -e "$contentPath" ] || continue - contentPath="${contentPath#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc. - if [ -e "$PWD/$contentPath" ]; then - echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" - sourceTarArgs+=( --exclude "./$contentPath" ) - fi - done - tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" - echo >&2 "Complete! WordPress has been successfully copied to $PWD" - fi - - wpEnvs=( "${!WORDPRESS_@}" ) - if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then - for wpConfigDocker in \ - wp-config-docker.php \ - /usr/src/wordpress/wp-config-docker.php \ - ; do - if [ -s "$wpConfigDocker" ]; then - echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" - # using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) - awk ' - /put your unique phrase here/ { - cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" - cmd | getline str - close(cmd) - gsub("put your unique phrase here", str) - } - { print } - ' "$wpConfigDocker" > wp-config.php - if [ "$uid" = '0' ]; then - # attempt to ensure that wp-config.php is owned by the run user - # could be on a filesystem that doesn't allow chown (like some NFS setups) - chown "$user:$group" wp-config.php || true - fi - break - fi - done - fi -fi - -exec "$@" diff --git a/latest/php7.4/fpm/wp-config-docker.php b/latest/php7.4/fpm/wp-config-docker.php deleted file mode 100644 index f62fc1f77a..0000000000 --- a/latest/php7.4/fpm/wp-config-docker.php +++ /dev/null @@ -1,133 +0,0 @@ -