From ab896f5c214309fbaffa8cd4bba76412701bd19b Mon Sep 17 00:00:00 2001 From: Pierre Gordon Date: Sun, 1 Sep 2019 11:13:17 -0500 Subject: [PATCH 01/16] Dynamically change UID and GID of PHP-FPM process --- 5.2/php/Dockerfile | 12 ++- 5.2/php/entrypoint.sh | 7 ++ 5.2/php/php-fpm.conf | 3 + 5.3/php/Dockerfile | 12 ++- 5.3/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 5.3/php/entrypoint.sh | 7 ++ 5.3/php/php-fpm.conf | 3 + 5.4/php/Dockerfile | 12 ++- 5.4/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 5.4/php/entrypoint.sh | 7 ++ 5.4/php/php-fpm.conf | 3 + 5.5/php/Dockerfile | 12 ++- 5.5/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 5.5/php/entrypoint.sh | 7 ++ 5.5/php/php-fpm.conf | 3 + 5.6/php/Dockerfile | 12 ++- 5.6/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 5.6/php/entrypoint.sh | 7 ++ 5.6/php/php-fpm.conf | 3 + 7.0/php/Dockerfile | 12 ++- 7.0/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 7.0/php/entrypoint.sh | 7 ++ 7.0/php/php-fpm.conf | 3 + 7.1/php/Dockerfile | 12 ++- 7.1/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 7.1/php/entrypoint.sh | 7 ++ 7.1/php/php-fpm.conf | 3 + 7.2/php/Dockerfile | 12 ++- 7.2/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 7.2/php/entrypoint.sh | 7 ++ 7.2/php/php-fpm.conf | 3 + 7.3/php/Dockerfile | 12 ++- 7.3/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 7.3/php/entrypoint.sh | 7 ++ 7.3/php/php-fpm.conf | 3 + 7.4/php/Dockerfile | 12 ++- 7.4/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 7.4/php/entrypoint.sh | 7 ++ 7.4/php/php-fpm.conf | 3 + 8.0/php/Dockerfile | 12 ++- 8.0/php/docker-entrypoint.d/100-uid-gid.sh | 116 ++++++++++++++++++++ 8.0/php/entrypoint.sh | 7 ++ 8.0/php/php-fpm.conf | 3 + Dockerfile-php.template | 12 ++- docker-entrypoint.d/100-uid-gid.sh | 117 +++++++++++++++++++++ entrypoint-php.sh | 7 ++ php-fpm-php.conf | 3 + update.php | 7 ++ 48 files changed, 1536 insertions(+), 12 deletions(-) mode change 100644 => 100755 5.2/php/entrypoint.sh create mode 100644 5.2/php/php-fpm.conf create mode 100644 5.3/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 5.3/php/entrypoint.sh create mode 100644 5.3/php/php-fpm.conf create mode 100644 5.4/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 5.4/php/entrypoint.sh create mode 100644 5.4/php/php-fpm.conf create mode 100644 5.5/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 5.5/php/entrypoint.sh create mode 100644 5.5/php/php-fpm.conf create mode 100644 5.6/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 5.6/php/entrypoint.sh create mode 100644 5.6/php/php-fpm.conf create mode 100644 7.0/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 7.0/php/entrypoint.sh create mode 100644 7.0/php/php-fpm.conf create mode 100644 7.1/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 7.1/php/entrypoint.sh create mode 100644 7.1/php/php-fpm.conf create mode 100644 7.2/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 7.2/php/entrypoint.sh create mode 100644 7.2/php/php-fpm.conf create mode 100755 7.3/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 7.3/php/entrypoint.sh create mode 100644 7.3/php/php-fpm.conf create mode 100644 7.4/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 7.4/php/entrypoint.sh create mode 100644 7.4/php/php-fpm.conf create mode 100644 8.0/php/docker-entrypoint.d/100-uid-gid.sh mode change 100644 => 100755 8.0/php/entrypoint.sh create mode 100644 8.0/php/php-fpm.conf create mode 100644 docker-entrypoint.d/100-uid-gid.sh create mode 100644 php-fpm-php.conf diff --git a/5.2/php/Dockerfile b/5.2/php/Dockerfile index c549052d..1987266d 100644 --- a/5.2/php/Dockerfile +++ b/5.2/php/Dockerfile @@ -11,11 +11,21 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.2/php/entrypoint.sh b/5.2/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/5.2/php/entrypoint.sh +++ b/5.2/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/5.2/php/php-fpm.conf b/5.2/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/5.2/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/5.3/php/Dockerfile b/5.3/php/Dockerfile index bdbd441f..1b28fa14 100644 --- a/5.3/php/Dockerfile +++ b/5.3/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -34,8 +41,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.3/php/docker-entrypoint.d/100-uid-gid.sh b/5.3/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/5.3/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/5.3/php/entrypoint.sh b/5.3/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/5.3/php/entrypoint.sh +++ b/5.3/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/5.3/php/php-fpm.conf b/5.3/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/5.3/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/5.4/php/Dockerfile b/5.4/php/Dockerfile index fb5dae31..a37b05fd 100644 --- a/5.4/php/Dockerfile +++ b/5.4/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -45,8 +52,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.4/php/docker-entrypoint.d/100-uid-gid.sh b/5.4/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/5.4/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/5.4/php/entrypoint.sh b/5.4/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/5.4/php/entrypoint.sh +++ b/5.4/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/5.4/php/php-fpm.conf b/5.4/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/5.4/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/5.5/php/Dockerfile b/5.5/php/Dockerfile index afb0a4f5..2ea81fb8 100644 --- a/5.5/php/Dockerfile +++ b/5.5/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -45,8 +52,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.5/php/docker-entrypoint.d/100-uid-gid.sh b/5.5/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/5.5/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/5.5/php/entrypoint.sh b/5.5/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/5.5/php/entrypoint.sh +++ b/5.5/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/5.5/php/php-fpm.conf b/5.5/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/5.5/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/5.6/php/Dockerfile b/5.6/php/Dockerfile index 722c27a9..edffb237 100644 --- a/5.6/php/Dockerfile +++ b/5.6/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -45,8 +52,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.6/php/docker-entrypoint.d/100-uid-gid.sh b/5.6/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/5.6/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/5.6/php/entrypoint.sh b/5.6/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/5.6/php/entrypoint.sh +++ b/5.6/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/5.6/php/php-fpm.conf b/5.6/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/5.6/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/7.0/php/Dockerfile b/7.0/php/Dockerfile index 7cf55d9f..1704d54f 100644 --- a/7.0/php/Dockerfile +++ b/7.0/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -45,8 +52,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.0/php/docker-entrypoint.d/100-uid-gid.sh b/7.0/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/7.0/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/7.0/php/entrypoint.sh b/7.0/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/7.0/php/entrypoint.sh +++ b/7.0/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/7.0/php/php-fpm.conf b/7.0/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/7.0/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/7.1/php/Dockerfile b/7.1/php/Dockerfile index 8851c74f..5304da13 100644 --- a/7.1/php/Dockerfile +++ b/7.1/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -45,8 +52,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.1/php/docker-entrypoint.d/100-uid-gid.sh b/7.1/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/7.1/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/7.1/php/entrypoint.sh b/7.1/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/7.1/php/entrypoint.sh +++ b/7.1/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/7.1/php/php-fpm.conf b/7.1/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/7.1/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/7.2/php/Dockerfile b/7.2/php/Dockerfile index 74904ce9..2e8e6310 100644 --- a/7.2/php/Dockerfile +++ b/7.2/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -45,8 +52,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.2/php/docker-entrypoint.d/100-uid-gid.sh b/7.2/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/7.2/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/7.2/php/entrypoint.sh b/7.2/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/7.2/php/entrypoint.sh +++ b/7.2/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/7.2/php/php-fpm.conf b/7.2/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/7.2/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/7.3/php/Dockerfile b/7.3/php/Dockerfile index f87fd133..e85c7ff1 100644 --- a/7.3/php/Dockerfile +++ b/7.3/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -45,8 +52,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.3/php/docker-entrypoint.d/100-uid-gid.sh b/7.3/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100755 index 00000000..b1f3ca68 --- /dev/null +++ b/7.3/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/7.3/php/entrypoint.sh b/7.3/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/7.3/php/entrypoint.sh +++ b/7.3/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/7.3/php/php-fpm.conf b/7.3/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/7.3/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/7.4/php/Dockerfile b/7.4/php/Dockerfile index 81a348ea..10570292 100644 --- a/7.4/php/Dockerfile +++ b/7.4/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -45,8 +52,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.4/php/docker-entrypoint.d/100-uid-gid.sh b/7.4/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/7.4/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/7.4/php/entrypoint.sh b/7.4/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/7.4/php/entrypoint.sh +++ b/7.4/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/7.4/php/php-fpm.conf b/7.4/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/7.4/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/8.0/php/Dockerfile b/8.0/php/Dockerfile index 0b09e309..c3f449f5 100644 --- a/8.0/php/Dockerfile +++ b/8.0/php/Dockerfile @@ -11,6 +11,13 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + # install the PHP extensions we need RUN set -ex; \ \ @@ -36,8 +43,11 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/8.0/php/docker-entrypoint.d/100-uid-gid.sh b/8.0/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..b1f3ca68 --- /dev/null +++ b/8.0/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,116 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user and group + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/8.0/php/entrypoint.sh b/8.0/php/entrypoint.sh old mode 100644 new mode 100755 index 51f8e5e0..e5b1fbb4 --- a/8.0/php/entrypoint.sh +++ b/8.0/php/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/8.0/php/php-fpm.conf b/8.0/php/php-fpm.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/8.0/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/Dockerfile-php.template b/Dockerfile-php.template index 7fc8dfa6..a6293091 100644 --- a/Dockerfile-php.template +++ b/Dockerfile-php.template @@ -7,11 +7,21 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp +# Update the user/group in "php-fpm.conf" if +# PHP_FPM_USER or PHP_FPM_GROUP is changed +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 + %%INSTALL_EXTENSIONS%% COPY entrypoint.sh /entrypoint.sh +COPY docker-entrypoint.d /docker-entrypoint.d +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /docker-entrypoint.d/*.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/docker-entrypoint.d/100-uid-gid.sh b/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..e6d266d0 --- /dev/null +++ b/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,117 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + # GID not found, let's create a new group + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/entrypoint-php.sh b/entrypoint-php.sh index 51f8e5e0..e5b1fbb4 100644 --- a/entrypoint-php.sh +++ b/entrypoint-php.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source /docker-entrypoint.d/100-uid-gid.sh + # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -17,5 +19,10 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" +set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" + # Execute CMD exec "$@" diff --git a/php-fpm-php.conf b/php-fpm-php.conf new file mode 100644 index 00000000..fe69bdae --- /dev/null +++ b/php-fpm-php.conf @@ -0,0 +1,3 @@ +[www] +user = wp_php +group = wp_php \ No newline at end of file diff --git a/update.php b/update.php index aaf34ce7..3bf5e07c 100644 --- a/update.php +++ b/update.php @@ -285,6 +285,8 @@ } $dockerfile = str_replace( '%%INSTALL_EXTENSIONS%%', $install_extensions, $dockerfile ); + + echo shell_exec( "cp -r docker-entrypoint.d $version/$image" ); } } elseif ( $image === 'phpunit' ) { @@ -315,6 +317,11 @@ copy( "entrypoint-$image.sh", "$version/$image/entrypoint.sh" ); } + // Copy the PHP-FPM configuration, if it exists. + if ( file_exists( "php-fpm-$image.conf" ) ) { + copy( "php-fpm-$image.conf", "$version/$image/php-fpm.conf" ); + } + // Generate the build and push commands for this image/version. $build_cmd = "docker build --build-arg PACKAGE_REGISTRY=\$PACKAGE_REGISTRY --build-arg PR_TAG=\$PR_TAG"; $build_cmd .= " -t \$PACKAGE_REGISTRY/$image:$version-fpm\$PR_TAG"; From faff95761c085488c70d7257fa5bc49c0769b0f4 Mon Sep 17 00:00:00 2001 From: Pierre Gordon Date: Sun, 1 Sep 2019 23:36:25 -0500 Subject: [PATCH 02/16] Create a default user/group --- 5.2/php/Dockerfile | 12 +++++++----- 5.2/php/entrypoint.sh | 4 ++-- 5.3/php/Dockerfile | 12 +++++++----- 5.3/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 5.3/php/entrypoint.sh | 4 ++-- 5.4/php/Dockerfile | 12 +++++++----- 5.4/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 5.4/php/entrypoint.sh | 4 ++-- 5.5/php/Dockerfile | 12 +++++++----- 5.5/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 5.5/php/entrypoint.sh | 4 ++-- 5.6/php/Dockerfile | 12 +++++++----- 5.6/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 5.6/php/entrypoint.sh | 4 ++-- 7.0/php/Dockerfile | 12 +++++++----- 7.0/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 7.0/php/entrypoint.sh | 4 ++-- 7.1/php/Dockerfile | 12 +++++++----- 7.1/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 7.1/php/entrypoint.sh | 4 ++-- 7.2/php/Dockerfile | 12 +++++++----- 7.2/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 7.2/php/entrypoint.sh | 4 ++-- 7.3/php/Dockerfile | 12 +++++++----- 7.3/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 7.3/php/entrypoint.sh | 4 ++-- 7.4/php/Dockerfile | 12 +++++++----- 7.4/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 7.4/php/entrypoint.sh | 4 ++-- 8.0/php/Dockerfile | 12 +++++++----- 8.0/php/docker-entrypoint.d/100-uid-gid.sh | 3 ++- 8.0/php/entrypoint.sh | 4 ++-- Dockerfile-php.template | 12 +++++++----- entrypoint-php.sh | 4 ++-- 34 files changed, 128 insertions(+), 94 deletions(-) diff --git a/5.2/php/Dockerfile b/5.2/php/Dockerfile index 1987266d..2226ba65 100644 --- a/5.2/php/Dockerfile +++ b/5.2/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -25,7 +25,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.2/php/entrypoint.sh b/5.2/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/5.2/php/entrypoint.sh +++ b/5.2/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/5.3/php/Dockerfile b/5.3/php/Dockerfile index 1b28fa14..f9d689e3 100644 --- a/5.3/php/Dockerfile +++ b/5.3/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -45,7 +45,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.3/php/docker-entrypoint.d/100-uid-gid.sh b/5.3/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/5.3/php/docker-entrypoint.d/100-uid-gid.sh +++ b/5.3/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/5.3/php/entrypoint.sh b/5.3/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/5.3/php/entrypoint.sh +++ b/5.3/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/5.4/php/Dockerfile b/5.4/php/Dockerfile index a37b05fd..ba2bfaf8 100644 --- a/5.4/php/Dockerfile +++ b/5.4/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -56,7 +56,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.4/php/docker-entrypoint.d/100-uid-gid.sh b/5.4/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/5.4/php/docker-entrypoint.d/100-uid-gid.sh +++ b/5.4/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/5.4/php/entrypoint.sh b/5.4/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/5.4/php/entrypoint.sh +++ b/5.4/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/5.5/php/Dockerfile b/5.5/php/Dockerfile index 2ea81fb8..bff4f2c8 100644 --- a/5.5/php/Dockerfile +++ b/5.5/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -56,7 +56,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.5/php/docker-entrypoint.d/100-uid-gid.sh b/5.5/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/5.5/php/docker-entrypoint.d/100-uid-gid.sh +++ b/5.5/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/5.5/php/entrypoint.sh b/5.5/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/5.5/php/entrypoint.sh +++ b/5.5/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/5.6/php/Dockerfile b/5.6/php/Dockerfile index edffb237..60f863d4 100644 --- a/5.6/php/Dockerfile +++ b/5.6/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -56,7 +56,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.6/php/docker-entrypoint.d/100-uid-gid.sh b/5.6/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/5.6/php/docker-entrypoint.d/100-uid-gid.sh +++ b/5.6/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/5.6/php/entrypoint.sh b/5.6/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/5.6/php/entrypoint.sh +++ b/5.6/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/7.0/php/Dockerfile b/7.0/php/Dockerfile index 1704d54f..1aa90d2c 100644 --- a/7.0/php/Dockerfile +++ b/7.0/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -56,7 +56,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.0/php/docker-entrypoint.d/100-uid-gid.sh b/7.0/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/7.0/php/docker-entrypoint.d/100-uid-gid.sh +++ b/7.0/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/7.0/php/entrypoint.sh b/7.0/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/7.0/php/entrypoint.sh +++ b/7.0/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/7.1/php/Dockerfile b/7.1/php/Dockerfile index 5304da13..738495d1 100644 --- a/7.1/php/Dockerfile +++ b/7.1/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -56,7 +56,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.1/php/docker-entrypoint.d/100-uid-gid.sh b/7.1/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/7.1/php/docker-entrypoint.d/100-uid-gid.sh +++ b/7.1/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/7.1/php/entrypoint.sh b/7.1/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/7.1/php/entrypoint.sh +++ b/7.1/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/7.2/php/Dockerfile b/7.2/php/Dockerfile index 2e8e6310..90718672 100644 --- a/7.2/php/Dockerfile +++ b/7.2/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -56,7 +56,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.2/php/docker-entrypoint.d/100-uid-gid.sh b/7.2/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/7.2/php/docker-entrypoint.d/100-uid-gid.sh +++ b/7.2/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/7.2/php/entrypoint.sh b/7.2/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/7.2/php/entrypoint.sh +++ b/7.2/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/7.3/php/Dockerfile b/7.3/php/Dockerfile index e85c7ff1..a27eae14 100644 --- a/7.3/php/Dockerfile +++ b/7.3/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -56,7 +56,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.3/php/docker-entrypoint.d/100-uid-gid.sh b/7.3/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100755 --- a/7.3/php/docker-entrypoint.d/100-uid-gid.sh +++ b/7.3/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/7.3/php/entrypoint.sh b/7.3/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/7.3/php/entrypoint.sh +++ b/7.3/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/7.4/php/Dockerfile b/7.4/php/Dockerfile index 10570292..2984e7ef 100644 --- a/7.4/php/Dockerfile +++ b/7.4/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -56,7 +56,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.4/php/docker-entrypoint.d/100-uid-gid.sh b/7.4/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/7.4/php/docker-entrypoint.d/100-uid-gid.sh +++ b/7.4/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/7.4/php/entrypoint.sh b/7.4/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/7.4/php/entrypoint.sh +++ b/7.4/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/8.0/php/Dockerfile b/8.0/php/Dockerfile index c3f449f5..564b3640 100644 --- a/8.0/php/Dockerfile +++ b/8.0/php/Dockerfile @@ -11,10 +11,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -47,7 +47,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/8.0/php/docker-entrypoint.d/100-uid-gid.sh b/8.0/php/docker-entrypoint.d/100-uid-gid.sh index b1f3ca68..e6d266d0 100644 --- a/8.0/php/docker-entrypoint.d/100-uid-gid.sh +++ b/8.0/php/docker-entrypoint.d/100-uid-gid.sh @@ -76,7 +76,7 @@ set_uid() { log "warn" "User with ${uid} already exists: ${target_username}" usermod -u "${spare_uid}" "${target_username}" fi - # UID not found, let's create a new user and group + # UID not found, let's create a new user else useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" return 0 @@ -107,6 +107,7 @@ set_gid() { log "warn" "Group with ${gid} already exists: ${target_groupname}" groupmod -g "${spare_gid}" "${target_groupname}" fi + # GID not found, let's create a new group else groupadd -g "${gid}" -r "${groupname}" return 0 diff --git a/8.0/php/entrypoint.sh b/8.0/php/entrypoint.sh index e5b1fbb4..951eb82f 100755 --- a/8.0/php/entrypoint.sh +++ b/8.0/php/entrypoint.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" diff --git a/Dockerfile-php.template b/Dockerfile-php.template index a6293091..7497edc8 100644 --- a/Dockerfile-php.template +++ b/Dockerfile-php.template @@ -7,10 +7,10 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" if -# PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php +# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" +# if PHP_FPM_USER or PHP_FPM_GROUP is changed +ARG PHP_FPM_USER wp_php +ARG PHP_FPM_GROUP wp_php ENV PHP_FPM_UID 1000 ENV PHP_FPM_GID 1000 @@ -21,7 +21,9 @@ COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh + chmod +x /docker-entrypoint.d/*.sh && \ + groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ + useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/entrypoint-php.sh b/entrypoint-php.sh index e5b1fbb4..951eb82f 100644 --- a/entrypoint-php.sh +++ b/entrypoint-php.sh @@ -21,8 +21,8 @@ fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "${PHP_FPM_GROUP}" -set_uid "${PHP_FPM_UID}" "${PHP_FPM_USER}" "${PHP_FPM_GROUP}" +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD exec "$@" From 18ff19815850268d00129fed4459d39ffdc35a0a Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 09:30:42 +1000 Subject: [PATCH 03/16] Use ENV instead of ARG in the Dockerfile to define the user. --- 5.2/php/Dockerfile | 8 ++++---- 5.3/php/Dockerfile | 8 ++++---- 5.4/php/Dockerfile | 8 ++++---- 5.5/php/Dockerfile | 8 ++++---- 5.6/php/Dockerfile | 8 ++++---- 7.0/php/Dockerfile | 8 ++++---- 7.1/php/Dockerfile | 8 ++++---- 7.2/php/Dockerfile | 8 ++++---- 7.3/php/Dockerfile | 8 ++++---- 7.4/php/Dockerfile | 8 ++++---- 8.0/php/Dockerfile | 8 ++++---- Dockerfile-php.template | 8 ++++---- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/5.2/php/Dockerfile b/5.2/php/Dockerfile index 2226ba65..98b3cd32 100644 --- a/5.2/php/Dockerfile +++ b/5.2/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 diff --git a/5.3/php/Dockerfile b/5.3/php/Dockerfile index f9d689e3..c84020a4 100644 --- a/5.3/php/Dockerfile +++ b/5.3/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/5.4/php/Dockerfile b/5.4/php/Dockerfile index ba2bfaf8..bd5eec38 100644 --- a/5.4/php/Dockerfile +++ b/5.4/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/5.5/php/Dockerfile b/5.5/php/Dockerfile index bff4f2c8..cff894aa 100644 --- a/5.5/php/Dockerfile +++ b/5.5/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/5.6/php/Dockerfile b/5.6/php/Dockerfile index 60f863d4..ce18cc0c 100644 --- a/5.6/php/Dockerfile +++ b/5.6/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/7.0/php/Dockerfile b/7.0/php/Dockerfile index 1aa90d2c..1f9a0ed0 100644 --- a/7.0/php/Dockerfile +++ b/7.0/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/7.1/php/Dockerfile b/7.1/php/Dockerfile index 738495d1..b07e255f 100644 --- a/7.1/php/Dockerfile +++ b/7.1/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/7.2/php/Dockerfile b/7.2/php/Dockerfile index 90718672..019612d3 100644 --- a/7.2/php/Dockerfile +++ b/7.2/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/7.3/php/Dockerfile b/7.3/php/Dockerfile index a27eae14..b982a24b 100644 --- a/7.3/php/Dockerfile +++ b/7.3/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/7.4/php/Dockerfile b/7.4/php/Dockerfile index 2984e7ef..b7e35ac9 100644 --- a/7.4/php/Dockerfile +++ b/7.4/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/8.0/php/Dockerfile b/8.0/php/Dockerfile index 564b3640..7a2cd175 100644 --- a/8.0/php/Dockerfile +++ b/8.0/php/Dockerfile @@ -13,10 +13,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 # install the PHP extensions we need RUN set -ex; \ diff --git a/Dockerfile-php.template b/Dockerfile-php.template index 7497edc8..756cc1ba 100644 --- a/Dockerfile-php.template +++ b/Dockerfile-php.template @@ -9,10 +9,10 @@ ENV COMPOSER_HOME /tmp # Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" # if PHP_FPM_USER or PHP_FPM_GROUP is changed -ARG PHP_FPM_USER wp_php -ARG PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 +ENV PHP_FPM_USER wp_php +ENV PHP_FPM_GROUP wp_php +ENV PHP_FPM_UID 1000 +ENV PHP_FPM_GID 1000 %%INSTALL_EXTENSIONS%% From 642363bb6f06a067ebae8c3f8a238156323654f5 Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 09:46:03 +1000 Subject: [PATCH 04/16] Fix docker-entrypoint.d not being copied. --- 5.2/php/docker-entrypoint.d/100-uid-gid.sh | 117 +++++++++++++++++++++ update.php | 3 +- 2 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 5.2/php/docker-entrypoint.d/100-uid-gid.sh diff --git a/5.2/php/docker-entrypoint.d/100-uid-gid.sh b/5.2/php/docker-entrypoint.d/100-uid-gid.sh new file mode 100644 index 00000000..e6d266d0 --- /dev/null +++ b/5.2/php/docker-entrypoint.d/100-uid-gid.sh @@ -0,0 +1,117 @@ +#!/bin/bash +set -e + + +############################################################ +# Functions +############################################################ + +### +### Log to stdout/stderr +### +log() { + local type="${1}" # ok, warn or err + local message="${2}" # msg to print + + local clr_ok="\033[0;32m" + local clr_info="\033[0;34m" + local clr_warn="\033[0;33m" + local clr_err="\033[0;31m" + local clr_rst="\033[0m" + + if [ "${type}" = "warn" ]; then + printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + elif [ "${type}" = "err" ]; then + printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + else + printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr + fi +} + +### +### Is argument a positive integer? +### +isint() { + test -n "${1##*[!0-9]*}" +} + +### +### Helper +### +_get_username_by_uid() { + if getent="$( getent passwd "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} +_get_groupname_by_gid() { + if getent="$( getent group "${1}" )"; then + echo "${getent//:*}" + return 0 + fi + return 1 +} + + +### +### Change UID +### +set_uid() { + local uid="${1}" + local username="${2}" + local groupname="${3}" + + # spare UID to change another user to + local spare_uid=9876 + + if ! isint "${uid}"; then + log "err" "${uid} is not a valid UID" + exit 1 + else + # Username with this UID already exists + if target_username="$( _get_username_by_uid "${uid}" )"; then + # It is not our user, so we need to change their UID to something else first + if [ "${target_username}" != "${username}" ]; then + log "warn" "User with ${uid} already exists: ${target_username}" + usermod -u "${spare_uid}" "${target_username}" + fi + # UID not found, let's create a new user + else + useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" + return 0 + fi + usermod -u "${uid}" "${username}" + fi +} + + +### +### Change GID +### +set_gid() { + local gid="${1}" + local groupname="${2}" + + # spare GID to change another group to + local spare_gid=9876 + + if ! isint "${gid}"; then + log "err" "${gid} is not a valid GID" + exit 1 + else + # Groupname with this GID already exists + if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then + # It is not our group, so we need to change their GID to something else first + if [ "${target_groupname}" != "${groupname}" ]; then + log "warn" "Group with ${gid} already exists: ${target_groupname}" + groupmod -g "${spare_gid}" "${target_groupname}" + fi + # GID not found, let's create a new group + else + groupadd -g "${gid}" -r "${groupname}" + return 0 + fi + groupmod -g "${gid}" "${groupname}" + fi +} diff --git a/update.php b/update.php index 3bf5e07c..ca220b3d 100644 --- a/update.php +++ b/update.php @@ -286,9 +286,10 @@ $dockerfile = str_replace( '%%INSTALL_EXTENSIONS%%', $install_extensions, $dockerfile ); - echo shell_exec( "cp -r docker-entrypoint.d $version/$image" ); } + echo shell_exec( "cp -R docker-entrypoint.d $version/$image" ); + } elseif ( $image === 'phpunit' ) { // Replace tags inside the PHPUnit Dockerfile template. $dockerfile = str_replace( '%%PHPUNIT_VERSION%%', $config, $dockerfile ); From c205705a2aa097d62c3dc13618666bed42bc8083 Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 14:02:30 +1000 Subject: [PATCH 05/16] Add entrypoints for everything, so we're setting the GID/UID. --- 5.2/cli/Dockerfile | 2 +- 5.2/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 5.2/php/entrypoint.sh | 1 - 5.2/phpunit/Dockerfile | 4 ++++ 5.2/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 5.3/cli/Dockerfile | 6 ++++-- 5.3/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 5.3/php/entrypoint.sh | 1 - 5.3/phpunit/Dockerfile | 4 ++++ 5.3/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 5.4/cli/Dockerfile | 6 ++++-- 5.4/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 5.4/php/entrypoint.sh | 1 - 5.4/phpunit/Dockerfile | 4 ++++ 5.4/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 5.5/cli/Dockerfile | 6 ++++-- 5.5/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 5.5/php/entrypoint.sh | 1 - 5.5/phpunit/Dockerfile | 4 ++++ 5.5/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 5.6/cli/Dockerfile | 6 ++++-- 5.6/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 5.6/php/entrypoint.sh | 1 - 5.6/phpunit/Dockerfile | 4 ++++ 5.6/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 7.0/cli/Dockerfile | 6 ++++-- 7.0/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 7.0/php/entrypoint.sh | 1 - 7.0/phpunit/Dockerfile | 4 ++++ 7.0/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 7.1/cli/Dockerfile | 6 ++++-- 7.1/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 7.1/php/entrypoint.sh | 1 - 7.1/phpunit/Dockerfile | 4 ++++ 7.1/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 7.2/cli/Dockerfile | 6 ++++-- 7.2/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 7.2/php/entrypoint.sh | 1 - 7.2/phpunit/Dockerfile | 4 ++++ 7.2/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 7.3/cli/Dockerfile | 6 ++++-- 7.3/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 7.3/php/entrypoint.sh | 1 - 7.3/phpunit/Dockerfile | 4 ++++ 7.3/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 7.4/cli/Dockerfile | 6 ++++-- 7.4/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 7.4/php/entrypoint.sh | 1 - 7.4/phpunit/Dockerfile | 4 ++++ 7.4/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ 8.0/cli/Dockerfile | 6 ++++-- 8.0/cli/entrypoint.sh | 38 +++++++++++++++++++++++++++++++++++++ 8.0/php/entrypoint.sh | 1 - 8.0/phpunit/Dockerfile | 4 ++++ 8.0/phpunit/entrypoint.sh | 27 ++++++++++++++++++++++++++ Dockerfile-cli.template | 6 ++++-- Dockerfile-phpunit.template | 4 ++++ entrypoint-cli.sh | 38 +++++++++++++++++++++++++++++++++++++ entrypoint-php.sh | 1 - entrypoint-phpunit.sh | 27 ++++++++++++++++++++++++++ 60 files changed, 873 insertions(+), 35 deletions(-) create mode 100644 5.2/cli/entrypoint.sh create mode 100644 5.2/phpunit/entrypoint.sh create mode 100644 5.3/cli/entrypoint.sh create mode 100644 5.3/phpunit/entrypoint.sh create mode 100644 5.4/cli/entrypoint.sh create mode 100644 5.4/phpunit/entrypoint.sh create mode 100644 5.5/cli/entrypoint.sh create mode 100644 5.5/phpunit/entrypoint.sh create mode 100644 5.6/cli/entrypoint.sh create mode 100644 5.6/phpunit/entrypoint.sh create mode 100644 7.0/cli/entrypoint.sh create mode 100644 7.0/phpunit/entrypoint.sh create mode 100644 7.1/cli/entrypoint.sh create mode 100644 7.1/phpunit/entrypoint.sh create mode 100644 7.2/cli/entrypoint.sh create mode 100644 7.2/phpunit/entrypoint.sh create mode 100644 7.3/cli/entrypoint.sh create mode 100644 7.3/phpunit/entrypoint.sh create mode 100644 7.4/cli/entrypoint.sh create mode 100644 7.4/phpunit/entrypoint.sh create mode 100644 8.0/cli/entrypoint.sh create mode 100644 8.0/phpunit/entrypoint.sh create mode 100644 entrypoint-cli.sh create mode 100644 entrypoint-phpunit.sh diff --git a/5.2/cli/Dockerfile b/5.2/cli/Dockerfile index 3a452826..ce36fa40 100644 --- a/5.2/cli/Dockerfile +++ b/5.2/cli/Dockerfile @@ -14,4 +14,4 @@ ENTRYPOINT [ "echo", "WP-CLI is not available for PHP 5.2-fpm.\nCommand was not WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/5.2/cli/entrypoint.sh b/5.2/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/5.2/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/5.2/php/entrypoint.sh b/5.2/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/5.2/php/entrypoint.sh +++ b/5.2/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/5.2/phpunit/Dockerfile b/5.2/phpunit/Dockerfile index fd126d67..8e172888 100644 --- a/5.2/phpunit/Dockerfile +++ b/5.2/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-3.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/5.2/phpunit/entrypoint.sh b/5.2/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/5.2/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/5.3/cli/Dockerfile b/5.3/cli/Dockerfile index 996b66d1..6ebdf790 100644 --- a/5.3/cli/Dockerfile +++ b/5.3/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/5.3/cli/entrypoint.sh b/5.3/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/5.3/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/5.3/php/entrypoint.sh b/5.3/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/5.3/php/entrypoint.sh +++ b/5.3/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/5.3/phpunit/Dockerfile b/5.3/phpunit/Dockerfile index 0d3a0d21..2ec4f340 100644 --- a/5.3/phpunit/Dockerfile +++ b/5.3/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/5.3/phpunit/entrypoint.sh b/5.3/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/5.3/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/5.4/cli/Dockerfile b/5.4/cli/Dockerfile index 5873d3a1..7a222575 100644 --- a/5.4/cli/Dockerfile +++ b/5.4/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/5.4/cli/entrypoint.sh b/5.4/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/5.4/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/5.4/php/entrypoint.sh b/5.4/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/5.4/php/entrypoint.sh +++ b/5.4/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/5.4/phpunit/Dockerfile b/5.4/phpunit/Dockerfile index 44589e73..d1331132 100644 --- a/5.4/phpunit/Dockerfile +++ b/5.4/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/5.4/phpunit/entrypoint.sh b/5.4/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/5.4/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/5.5/cli/Dockerfile b/5.5/cli/Dockerfile index cd957739..2a04c3da 100644 --- a/5.5/cli/Dockerfile +++ b/5.5/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/5.5/cli/entrypoint.sh b/5.5/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/5.5/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/5.5/php/entrypoint.sh b/5.5/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/5.5/php/entrypoint.sh +++ b/5.5/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/5.5/phpunit/Dockerfile b/5.5/phpunit/Dockerfile index 7957624f..5d764b85 100644 --- a/5.5/phpunit/Dockerfile +++ b/5.5/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/5.5/phpunit/entrypoint.sh b/5.5/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/5.5/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/5.6/cli/Dockerfile b/5.6/cli/Dockerfile index aa20edd8..1741e6b5 100644 --- a/5.6/cli/Dockerfile +++ b/5.6/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/5.6/cli/entrypoint.sh b/5.6/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/5.6/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/5.6/php/entrypoint.sh b/5.6/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/5.6/php/entrypoint.sh +++ b/5.6/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/5.6/phpunit/Dockerfile b/5.6/phpunit/Dockerfile index 182ef8f6..4058f649 100644 --- a/5.6/phpunit/Dockerfile +++ b/5.6/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-5.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/5.6/phpunit/entrypoint.sh b/5.6/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/5.6/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/7.0/cli/Dockerfile b/7.0/cli/Dockerfile index 2db8a094..2b6df00c 100644 --- a/7.0/cli/Dockerfile +++ b/7.0/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/7.0/cli/entrypoint.sh b/7.0/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/7.0/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/7.0/php/entrypoint.sh b/7.0/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/7.0/php/entrypoint.sh +++ b/7.0/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/7.0/phpunit/Dockerfile b/7.0/phpunit/Dockerfile index 127f90a8..daafce25 100644 --- a/7.0/phpunit/Dockerfile +++ b/7.0/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-6.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/7.0/phpunit/entrypoint.sh b/7.0/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/7.0/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/7.1/cli/Dockerfile b/7.1/cli/Dockerfile index aa228c5d..8dc2ff76 100644 --- a/7.1/cli/Dockerfile +++ b/7.1/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/7.1/cli/entrypoint.sh b/7.1/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/7.1/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/7.1/php/entrypoint.sh b/7.1/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/7.1/php/entrypoint.sh +++ b/7.1/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/7.1/phpunit/Dockerfile b/7.1/phpunit/Dockerfile index 87f7c1b2..368f0803 100644 --- a/7.1/phpunit/Dockerfile +++ b/7.1/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/7.1/phpunit/entrypoint.sh b/7.1/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/7.1/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/7.2/cli/Dockerfile b/7.2/cli/Dockerfile index 6e3c4d31..077a2ff1 100644 --- a/7.2/cli/Dockerfile +++ b/7.2/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/7.2/cli/entrypoint.sh b/7.2/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/7.2/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/7.2/php/entrypoint.sh b/7.2/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/7.2/php/entrypoint.sh +++ b/7.2/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/7.2/phpunit/Dockerfile b/7.2/phpunit/Dockerfile index f2076170..516afdf9 100644 --- a/7.2/phpunit/Dockerfile +++ b/7.2/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/7.2/phpunit/entrypoint.sh b/7.2/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/7.2/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/7.3/cli/Dockerfile b/7.3/cli/Dockerfile index 1a59ff1f..6f72a742 100644 --- a/7.3/cli/Dockerfile +++ b/7.3/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/7.3/cli/entrypoint.sh b/7.3/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/7.3/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/7.3/php/entrypoint.sh b/7.3/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/7.3/php/entrypoint.sh +++ b/7.3/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/7.3/phpunit/Dockerfile b/7.3/phpunit/Dockerfile index 2eb1aeba..03384c04 100644 --- a/7.3/phpunit/Dockerfile +++ b/7.3/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/7.3/phpunit/entrypoint.sh b/7.3/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/7.3/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/7.4/cli/Dockerfile b/7.4/cli/Dockerfile index 78ebaadd..6146fc2d 100644 --- a/7.4/cli/Dockerfile +++ b/7.4/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/7.4/cli/entrypoint.sh b/7.4/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/7.4/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/7.4/php/entrypoint.sh b/7.4/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/7.4/php/entrypoint.sh +++ b/7.4/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/7.4/phpunit/Dockerfile b/7.4/phpunit/Dockerfile index c9dc2a26..cbad35ff 100644 --- a/7.4/phpunit/Dockerfile +++ b/7.4/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/7.4/phpunit/entrypoint.sh b/7.4/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/7.4/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/8.0/cli/Dockerfile b/8.0/cli/Dockerfile index 0411270d..815713ff 100644 --- a/8.0/cli/Dockerfile +++ b/8.0/cli/Dockerfile @@ -27,9 +27,11 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/8.0/cli/entrypoint.sh b/8.0/cli/entrypoint.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/8.0/cli/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/8.0/php/entrypoint.sh b/8.0/php/entrypoint.sh index 951eb82f..a8383695 100755 --- a/8.0/php/entrypoint.sh +++ b/8.0/php/entrypoint.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/8.0/phpunit/Dockerfile b/8.0/phpunit/Dockerfile index ecdaf154..5a3eeff7 100644 --- a/8.0/phpunit/Dockerfile +++ b/8.0/phpunit/Dockerfile @@ -12,4 +12,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/8.0/phpunit/entrypoint.sh b/8.0/phpunit/entrypoint.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/8.0/phpunit/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" diff --git a/Dockerfile-cli.template b/Dockerfile-cli.template index 04ac9b34..5203d974 100644 --- a/Dockerfile-cli.template +++ b/Dockerfile-cli.template @@ -23,7 +23,9 @@ RUN set -ex; \ \ wp --allow-root --version; -ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ] +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] %%/NEW_PHP%% %%OLD_PHP%% @@ -32,4 +34,4 @@ ENTRYPOINT [ "echo", "WP-CLI is not available for PHP %%VERSION_TAG%%.\nCommand WORKDIR /var/www -CMD [ "shell" ] +CMD [ "wp", "shell" ] diff --git a/Dockerfile-phpunit.template b/Dockerfile-phpunit.template index ac72b836..4ac97afa 100644 --- a/Dockerfile-phpunit.template +++ b/Dockerfile-phpunit.template @@ -8,4 +8,8 @@ RUN curl -sL https://phar.phpunit.de/phpunit-%%PHPUNIT_VERSION%%.phar > /usr/loc WORKDIR /var/www +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] + CMD /usr/local/bin/phpunit diff --git a/entrypoint-cli.sh b/entrypoint-cli.sh new file mode 100644 index 00000000..2354a126 --- /dev/null +++ b/entrypoint-cli.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi + +# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +exec "$@" diff --git a/entrypoint-php.sh b/entrypoint-php.sh index 951eb82f..a8383695 100644 --- a/entrypoint-php.sh +++ b/entrypoint-php.sh @@ -19,7 +19,6 @@ else rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini fi - ### Change UID/GID set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" diff --git a/entrypoint-phpunit.sh b/entrypoint-phpunit.sh new file mode 100644 index 00000000..a8383695 --- /dev/null +++ b/entrypoint-phpunit.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +source /docker-entrypoint.d/100-uid-gid.sh + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +set_gid "${PHP_FPM_GID}" "wp_php" +set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" + +# Execute CMD +exec "$@" From df3f555f3cb42b337816394cf0ac28e659fa2d69 Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 14:36:49 +1000 Subject: [PATCH 06/16] Run as the correct user from the command line. --- 5.2/cli/entrypoint.sh | 2 +- 5.2/phpunit/Dockerfile | 4 +++- 5.2/phpunit/entrypoint.sh | 2 +- 5.3/cli/Dockerfile | 4 +++- 5.3/cli/entrypoint.sh | 2 +- 5.3/phpunit/Dockerfile | 4 +++- 5.3/phpunit/entrypoint.sh | 2 +- 5.4/cli/Dockerfile | 4 +++- 5.4/cli/entrypoint.sh | 2 +- 5.4/phpunit/Dockerfile | 4 +++- 5.4/phpunit/entrypoint.sh | 2 +- 5.5/cli/Dockerfile | 4 +++- 5.5/cli/entrypoint.sh | 2 +- 5.5/phpunit/Dockerfile | 4 +++- 5.5/phpunit/entrypoint.sh | 2 +- 5.6/cli/Dockerfile | 4 +++- 5.6/cli/entrypoint.sh | 2 +- 5.6/phpunit/Dockerfile | 4 +++- 5.6/phpunit/entrypoint.sh | 2 +- 7.0/cli/Dockerfile | 4 +++- 7.0/cli/entrypoint.sh | 2 +- 7.0/phpunit/Dockerfile | 4 +++- 7.0/phpunit/entrypoint.sh | 2 +- 7.1/cli/Dockerfile | 4 +++- 7.1/cli/entrypoint.sh | 2 +- 7.1/phpunit/Dockerfile | 4 +++- 7.1/phpunit/entrypoint.sh | 2 +- 7.2/cli/Dockerfile | 4 +++- 7.2/cli/entrypoint.sh | 2 +- 7.2/phpunit/Dockerfile | 4 +++- 7.2/phpunit/entrypoint.sh | 2 +- 7.3/cli/Dockerfile | 4 +++- 7.3/cli/entrypoint.sh | 2 +- 7.3/phpunit/Dockerfile | 4 +++- 7.3/phpunit/entrypoint.sh | 2 +- 7.4/cli/Dockerfile | 4 +++- 7.4/cli/entrypoint.sh | 2 +- 7.4/phpunit/Dockerfile | 4 +++- 7.4/phpunit/entrypoint.sh | 2 +- 8.0/cli/Dockerfile | 4 +++- 8.0/cli/entrypoint.sh | 2 +- 8.0/phpunit/Dockerfile | 4 +++- 8.0/phpunit/entrypoint.sh | 2 +- Dockerfile-cli.template | 4 +++- Dockerfile-phpunit.template | 4 +++- entrypoint-cli.sh | 2 +- entrypoint-phpunit.sh | 2 +- 47 files changed, 93 insertions(+), 47 deletions(-) diff --git a/5.2/cli/entrypoint.sh b/5.2/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/5.2/cli/entrypoint.sh +++ b/5.2/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.2/phpunit/Dockerfile b/5.2/phpunit/Dockerfile index 8e172888..3f7a3ae1 100644 --- a/5.2/phpunit/Dockerfile +++ b/5.2/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/5.2/phpunit/entrypoint.sh b/5.2/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/5.2/phpunit/entrypoint.sh +++ b/5.2/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.3/cli/Dockerfile b/5.3/cli/Dockerfile index 6ebdf790..746e5a5b 100644 --- a/5.3/cli/Dockerfile +++ b/5.3/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/5.3/cli/entrypoint.sh b/5.3/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/5.3/cli/entrypoint.sh +++ b/5.3/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.3/phpunit/Dockerfile b/5.3/phpunit/Dockerfile index 2ec4f340..06b80286 100644 --- a/5.3/phpunit/Dockerfile +++ b/5.3/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/5.3/phpunit/entrypoint.sh b/5.3/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/5.3/phpunit/entrypoint.sh +++ b/5.3/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.4/cli/Dockerfile b/5.4/cli/Dockerfile index 7a222575..068b8a50 100644 --- a/5.4/cli/Dockerfile +++ b/5.4/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/5.4/cli/entrypoint.sh b/5.4/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/5.4/cli/entrypoint.sh +++ b/5.4/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.4/phpunit/Dockerfile b/5.4/phpunit/Dockerfile index d1331132..25f11a80 100644 --- a/5.4/phpunit/Dockerfile +++ b/5.4/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/5.4/phpunit/entrypoint.sh b/5.4/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/5.4/phpunit/entrypoint.sh +++ b/5.4/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.5/cli/Dockerfile b/5.5/cli/Dockerfile index 2a04c3da..9faa1aba 100644 --- a/5.5/cli/Dockerfile +++ b/5.5/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/5.5/cli/entrypoint.sh b/5.5/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/5.5/cli/entrypoint.sh +++ b/5.5/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.5/phpunit/Dockerfile b/5.5/phpunit/Dockerfile index 5d764b85..d846f29b 100644 --- a/5.5/phpunit/Dockerfile +++ b/5.5/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/5.5/phpunit/entrypoint.sh b/5.5/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/5.5/phpunit/entrypoint.sh +++ b/5.5/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.6/cli/Dockerfile b/5.6/cli/Dockerfile index 1741e6b5..595f19b3 100644 --- a/5.6/cli/Dockerfile +++ b/5.6/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/5.6/cli/entrypoint.sh b/5.6/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/5.6/cli/entrypoint.sh +++ b/5.6/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/5.6/phpunit/Dockerfile b/5.6/phpunit/Dockerfile index 4058f649..292a2341 100644 --- a/5.6/phpunit/Dockerfile +++ b/5.6/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/5.6/phpunit/entrypoint.sh b/5.6/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/5.6/phpunit/entrypoint.sh +++ b/5.6/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.0/cli/Dockerfile b/7.0/cli/Dockerfile index 2b6df00c..48147c39 100644 --- a/7.0/cli/Dockerfile +++ b/7.0/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/7.0/cli/entrypoint.sh b/7.0/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/7.0/cli/entrypoint.sh +++ b/7.0/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.0/phpunit/Dockerfile b/7.0/phpunit/Dockerfile index daafce25..c1d4abfc 100644 --- a/7.0/phpunit/Dockerfile +++ b/7.0/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/7.0/phpunit/entrypoint.sh b/7.0/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/7.0/phpunit/entrypoint.sh +++ b/7.0/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.1/cli/Dockerfile b/7.1/cli/Dockerfile index 8dc2ff76..31097bbd 100644 --- a/7.1/cli/Dockerfile +++ b/7.1/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/7.1/cli/entrypoint.sh b/7.1/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/7.1/cli/entrypoint.sh +++ b/7.1/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.1/phpunit/Dockerfile b/7.1/phpunit/Dockerfile index 368f0803..b70b8f0a 100644 --- a/7.1/phpunit/Dockerfile +++ b/7.1/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/7.1/phpunit/entrypoint.sh b/7.1/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/7.1/phpunit/entrypoint.sh +++ b/7.1/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.2/cli/Dockerfile b/7.2/cli/Dockerfile index 077a2ff1..55c93e45 100644 --- a/7.2/cli/Dockerfile +++ b/7.2/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/7.2/cli/entrypoint.sh b/7.2/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/7.2/cli/entrypoint.sh +++ b/7.2/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.2/phpunit/Dockerfile b/7.2/phpunit/Dockerfile index 516afdf9..19a5a73b 100644 --- a/7.2/phpunit/Dockerfile +++ b/7.2/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/7.2/phpunit/entrypoint.sh b/7.2/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/7.2/phpunit/entrypoint.sh +++ b/7.2/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.3/cli/Dockerfile b/7.3/cli/Dockerfile index 6f72a742..00cd03d3 100644 --- a/7.3/cli/Dockerfile +++ b/7.3/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/7.3/cli/entrypoint.sh b/7.3/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/7.3/cli/entrypoint.sh +++ b/7.3/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.3/phpunit/Dockerfile b/7.3/phpunit/Dockerfile index 03384c04..5c992b29 100644 --- a/7.3/phpunit/Dockerfile +++ b/7.3/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/7.3/phpunit/entrypoint.sh b/7.3/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/7.3/phpunit/entrypoint.sh +++ b/7.3/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.4/cli/Dockerfile b/7.4/cli/Dockerfile index 6146fc2d..a462d5e7 100644 --- a/7.4/cli/Dockerfile +++ b/7.4/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/7.4/cli/entrypoint.sh b/7.4/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/7.4/cli/entrypoint.sh +++ b/7.4/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/7.4/phpunit/Dockerfile b/7.4/phpunit/Dockerfile index cbad35ff..1ffe0b1e 100644 --- a/7.4/phpunit/Dockerfile +++ b/7.4/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/7.4/phpunit/entrypoint.sh b/7.4/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/7.4/phpunit/entrypoint.sh +++ b/7.4/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/8.0/cli/Dockerfile b/8.0/cli/Dockerfile index 815713ff..8f4aa519 100644 --- a/8.0/cli/Dockerfile +++ b/8.0/cli/Dockerfile @@ -29,7 +29,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /var/www diff --git a/8.0/cli/entrypoint.sh b/8.0/cli/entrypoint.sh index 2354a126..3fa15746 100644 --- a/8.0/cli/entrypoint.sh +++ b/8.0/cli/entrypoint.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/8.0/phpunit/Dockerfile b/8.0/phpunit/Dockerfile index 5a3eeff7..fe606a84 100644 --- a/8.0/phpunit/Dockerfile +++ b/8.0/phpunit/Dockerfile @@ -14,6 +14,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/8.0/phpunit/entrypoint.sh b/8.0/phpunit/entrypoint.sh index a8383695..5e6ad370 100644 --- a/8.0/phpunit/entrypoint.sh +++ b/8.0/phpunit/entrypoint.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/Dockerfile-cli.template b/Dockerfile-cli.template index 5203d974..8ff5f468 100644 --- a/Dockerfile-cli.template +++ b/Dockerfile-cli.template @@ -25,7 +25,9 @@ RUN set -ex; \ COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] %%/NEW_PHP%% %%OLD_PHP%% diff --git a/Dockerfile-phpunit.template b/Dockerfile-phpunit.template index 4ac97afa..1cf4db31 100644 --- a/Dockerfile-phpunit.template +++ b/Dockerfile-phpunit.template @@ -10,6 +10,8 @@ WORKDIR /var/www COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "entrypoint.sh" ] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] CMD /usr/local/bin/phpunit diff --git a/entrypoint-cli.sh b/entrypoint-cli.sh index 2354a126..3fa15746 100644 --- a/entrypoint-cli.sh +++ b/entrypoint-cli.sh @@ -35,4 +35,4 @@ if wp --path=/dev/null help "$1" > /dev/null 2>&1; then fi # Execute CMD -exec "$@" +exec su wp_php -c "$@" diff --git a/entrypoint-phpunit.sh b/entrypoint-phpunit.sh index a8383695..5e6ad370 100644 --- a/entrypoint-phpunit.sh +++ b/entrypoint-phpunit.sh @@ -24,4 +24,4 @@ set_gid "${PHP_FPM_GID}" "wp_php" set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" # Execute CMD -exec "$@" +exec su wp_php -c "$@" From e9983bc64f4c4ee7602031b0400ecb515a11207a Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 15:06:27 +1000 Subject: [PATCH 07/16] Simplify everything. --- 5.2/cli/entrypoint.sh | 6 +- 5.2/php/Dockerfile | 12 +-- 5.2/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 5.2/php/entrypoint.sh | 6 +- 5.2/phpunit/entrypoint.sh | 6 +- 5.3/cli/entrypoint.sh | 6 +- 5.3/php/Dockerfile | 12 +-- 5.3/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 5.3/php/entrypoint.sh | 6 +- 5.3/phpunit/entrypoint.sh | 6 +- 5.4/cli/entrypoint.sh | 6 +- 5.4/php/Dockerfile | 12 +-- 5.4/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 5.4/php/entrypoint.sh | 6 +- 5.4/phpunit/entrypoint.sh | 6 +- 5.5/cli/entrypoint.sh | 6 +- 5.5/php/Dockerfile | 12 +-- 5.5/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 5.5/php/entrypoint.sh | 6 +- 5.5/phpunit/entrypoint.sh | 6 +- 5.6/cli/entrypoint.sh | 6 +- 5.6/php/Dockerfile | 12 +-- 5.6/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 5.6/php/entrypoint.sh | 6 +- 5.6/phpunit/entrypoint.sh | 6 +- 7.0/cli/entrypoint.sh | 6 +- 7.0/php/Dockerfile | 12 +-- 7.0/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 7.0/php/entrypoint.sh | 6 +- 7.0/phpunit/entrypoint.sh | 6 +- 7.1/cli/entrypoint.sh | 6 +- 7.1/php/Dockerfile | 12 +-- 7.1/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 7.1/php/entrypoint.sh | 6 +- 7.1/phpunit/entrypoint.sh | 6 +- 7.2/cli/entrypoint.sh | 6 +- 7.2/php/Dockerfile | 12 +-- 7.2/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 7.2/php/entrypoint.sh | 6 +- 7.2/phpunit/entrypoint.sh | 6 +- 7.3/cli/entrypoint.sh | 6 +- 7.3/php/Dockerfile | 12 +-- 7.3/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 7.3/php/entrypoint.sh | 6 +- 7.3/phpunit/entrypoint.sh | 6 +- 7.4/cli/entrypoint.sh | 6 +- 7.4/php/Dockerfile | 12 +-- 7.4/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 7.4/php/entrypoint.sh | 6 +- 7.4/phpunit/entrypoint.sh | 6 +- 8.0/cli/entrypoint.sh | 6 +- 8.0/php/Dockerfile | 12 +-- 8.0/php/docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- 8.0/php/entrypoint.sh | 6 +- 8.0/phpunit/entrypoint.sh | 6 +- Dockerfile-php.template | 12 +-- docker-entrypoint.d/100-uid-gid.sh | 117 --------------------- entrypoint-cli.sh | 6 +- entrypoint-php.sh | 6 +- entrypoint-phpunit.sh | 6 +- update.php | 2 - 61 files changed, 96 insertions(+), 1670 deletions(-) delete mode 100644 5.2/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 5.3/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 5.4/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 5.5/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 5.6/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 7.0/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 7.1/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 7.2/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100755 7.3/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 7.4/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 8.0/php/docker-entrypoint.d/100-uid-gid.sh delete mode 100644 docker-entrypoint.d/100-uid-gid.sh diff --git a/5.2/cli/entrypoint.sh b/5.2/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/5.2/cli/entrypoint.sh +++ b/5.2/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/5.2/php/Dockerfile b/5.2/php/Dockerfile index 98b3cd32..3eebc908 100644 --- a/5.2/php/Dockerfile +++ b/5.2/php/Dockerfile @@ -11,23 +11,15 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.2/php/docker-entrypoint.d/100-uid-gid.sh b/5.2/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/5.2/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/5.2/php/entrypoint.sh b/5.2/php/entrypoint.sh index a8383695..5560f819 100755 --- a/5.2/php/entrypoint.sh +++ b/5.2/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/5.2/phpunit/entrypoint.sh b/5.2/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/5.2/phpunit/entrypoint.sh +++ b/5.2/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/5.3/cli/entrypoint.sh b/5.3/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/5.3/cli/entrypoint.sh +++ b/5.3/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/5.3/php/Dockerfile b/5.3/php/Dockerfile index c84020a4..1dc840f1 100644 --- a/5.3/php/Dockerfile +++ b/5.3/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -41,13 +34,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.3/php/docker-entrypoint.d/100-uid-gid.sh b/5.3/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/5.3/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/5.3/php/entrypoint.sh b/5.3/php/entrypoint.sh index a8383695..5560f819 100755 --- a/5.3/php/entrypoint.sh +++ b/5.3/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/5.3/phpunit/entrypoint.sh b/5.3/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/5.3/phpunit/entrypoint.sh +++ b/5.3/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/5.4/cli/entrypoint.sh b/5.4/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/5.4/cli/entrypoint.sh +++ b/5.4/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/5.4/php/Dockerfile b/5.4/php/Dockerfile index bd5eec38..d0aa0552 100644 --- a/5.4/php/Dockerfile +++ b/5.4/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -52,13 +45,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.4/php/docker-entrypoint.d/100-uid-gid.sh b/5.4/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/5.4/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/5.4/php/entrypoint.sh b/5.4/php/entrypoint.sh index a8383695..5560f819 100755 --- a/5.4/php/entrypoint.sh +++ b/5.4/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/5.4/phpunit/entrypoint.sh b/5.4/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/5.4/phpunit/entrypoint.sh +++ b/5.4/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/5.5/cli/entrypoint.sh b/5.5/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/5.5/cli/entrypoint.sh +++ b/5.5/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/5.5/php/Dockerfile b/5.5/php/Dockerfile index cff894aa..3f5895bb 100644 --- a/5.5/php/Dockerfile +++ b/5.5/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -52,13 +45,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.5/php/docker-entrypoint.d/100-uid-gid.sh b/5.5/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/5.5/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/5.5/php/entrypoint.sh b/5.5/php/entrypoint.sh index a8383695..5560f819 100755 --- a/5.5/php/entrypoint.sh +++ b/5.5/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/5.5/phpunit/entrypoint.sh b/5.5/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/5.5/phpunit/entrypoint.sh +++ b/5.5/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/5.6/cli/entrypoint.sh b/5.6/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/5.6/cli/entrypoint.sh +++ b/5.6/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/5.6/php/Dockerfile b/5.6/php/Dockerfile index ce18cc0c..8fdf78a5 100644 --- a/5.6/php/Dockerfile +++ b/5.6/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -52,13 +45,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.6/php/docker-entrypoint.d/100-uid-gid.sh b/5.6/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/5.6/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/5.6/php/entrypoint.sh b/5.6/php/entrypoint.sh index a8383695..5560f819 100755 --- a/5.6/php/entrypoint.sh +++ b/5.6/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/5.6/phpunit/entrypoint.sh b/5.6/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/5.6/phpunit/entrypoint.sh +++ b/5.6/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/7.0/cli/entrypoint.sh b/7.0/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/7.0/cli/entrypoint.sh +++ b/7.0/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/7.0/php/Dockerfile b/7.0/php/Dockerfile index 1f9a0ed0..a312b8c2 100644 --- a/7.0/php/Dockerfile +++ b/7.0/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -52,13 +45,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.0/php/docker-entrypoint.d/100-uid-gid.sh b/7.0/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/7.0/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/7.0/php/entrypoint.sh b/7.0/php/entrypoint.sh index a8383695..5560f819 100755 --- a/7.0/php/entrypoint.sh +++ b/7.0/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/7.0/phpunit/entrypoint.sh b/7.0/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/7.0/phpunit/entrypoint.sh +++ b/7.0/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/7.1/cli/entrypoint.sh b/7.1/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/7.1/cli/entrypoint.sh +++ b/7.1/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/7.1/php/Dockerfile b/7.1/php/Dockerfile index b07e255f..29d891c6 100644 --- a/7.1/php/Dockerfile +++ b/7.1/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -52,13 +45,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.1/php/docker-entrypoint.d/100-uid-gid.sh b/7.1/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/7.1/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/7.1/php/entrypoint.sh b/7.1/php/entrypoint.sh index a8383695..5560f819 100755 --- a/7.1/php/entrypoint.sh +++ b/7.1/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/7.1/phpunit/entrypoint.sh b/7.1/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/7.1/phpunit/entrypoint.sh +++ b/7.1/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/7.2/cli/entrypoint.sh b/7.2/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/7.2/cli/entrypoint.sh +++ b/7.2/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/7.2/php/Dockerfile b/7.2/php/Dockerfile index 019612d3..06695a85 100644 --- a/7.2/php/Dockerfile +++ b/7.2/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -52,13 +45,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.2/php/docker-entrypoint.d/100-uid-gid.sh b/7.2/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/7.2/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/7.2/php/entrypoint.sh b/7.2/php/entrypoint.sh index a8383695..5560f819 100755 --- a/7.2/php/entrypoint.sh +++ b/7.2/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/7.2/phpunit/entrypoint.sh b/7.2/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/7.2/phpunit/entrypoint.sh +++ b/7.2/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/7.3/cli/entrypoint.sh b/7.3/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/7.3/cli/entrypoint.sh +++ b/7.3/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/7.3/php/Dockerfile b/7.3/php/Dockerfile index b982a24b..f7b26c0a 100644 --- a/7.3/php/Dockerfile +++ b/7.3/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -52,13 +45,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.3/php/docker-entrypoint.d/100-uid-gid.sh b/7.3/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100755 index e6d266d0..00000000 --- a/7.3/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/7.3/php/entrypoint.sh b/7.3/php/entrypoint.sh index a8383695..5560f819 100755 --- a/7.3/php/entrypoint.sh +++ b/7.3/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/7.3/phpunit/entrypoint.sh b/7.3/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/7.3/phpunit/entrypoint.sh +++ b/7.3/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/7.4/cli/entrypoint.sh b/7.4/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/7.4/cli/entrypoint.sh +++ b/7.4/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/7.4/php/Dockerfile b/7.4/php/Dockerfile index b7e35ac9..19ff221e 100644 --- a/7.4/php/Dockerfile +++ b/7.4/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -52,13 +45,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.4/php/docker-entrypoint.d/100-uid-gid.sh b/7.4/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/7.4/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/7.4/php/entrypoint.sh b/7.4/php/entrypoint.sh index a8383695..5560f819 100755 --- a/7.4/php/entrypoint.sh +++ b/7.4/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/7.4/phpunit/entrypoint.sh b/7.4/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/7.4/phpunit/entrypoint.sh +++ b/7.4/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/8.0/cli/entrypoint.sh b/8.0/cli/entrypoint.sh index 3fa15746..cbb41e45 100644 --- a/8.0/cli/entrypoint.sh +++ b/8.0/cli/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/8.0/php/Dockerfile b/8.0/php/Dockerfile index 7a2cd175..50cbf714 100644 --- a/8.0/php/Dockerfile +++ b/8.0/php/Dockerfile @@ -11,13 +11,6 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - # install the PHP extensions we need RUN set -ex; \ \ @@ -43,13 +36,12 @@ RUN set -ex; \ rm -f /tmp/installer.php /tmp/installer.sig; COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/8.0/php/docker-entrypoint.d/100-uid-gid.sh b/8.0/php/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/8.0/php/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/8.0/php/entrypoint.sh b/8.0/php/entrypoint.sh index a8383695..5560f819 100755 --- a/8.0/php/entrypoint.sh +++ b/8.0/php/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/8.0/phpunit/entrypoint.sh b/8.0/phpunit/entrypoint.sh index 5e6ad370..3fbf79ae 100644 --- a/8.0/phpunit/entrypoint.sh +++ b/8.0/phpunit/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/Dockerfile-php.template b/Dockerfile-php.template index 756cc1ba..20921d89 100644 --- a/Dockerfile-php.template +++ b/Dockerfile-php.template @@ -7,23 +7,15 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp -# Update the user/group in "php-fpm.conf" and "entrypoint-php.sh" -# if PHP_FPM_USER or PHP_FPM_GROUP is changed -ENV PHP_FPM_USER wp_php -ENV PHP_FPM_GROUP wp_php -ENV PHP_FPM_UID 1000 -ENV PHP_FPM_GID 1000 - %%INSTALL_EXTENSIONS%% COPY entrypoint.sh /entrypoint.sh -COPY docker-entrypoint.d /docker-entrypoint.d COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ chmod +x /docker-entrypoint.d/*.sh && \ - groupadd -g ${PHP_FPM_GID} -r ${PHP_FPM_GROUP} && \ - useradd -M -u ${PHP_FPM_UID} -s /bin/bash -g ${PHP_FPM_GROUP} ${PHP_FPM_USER} + groupadd -g 1000 -r wp_php && \ + useradd -M -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/docker-entrypoint.d/100-uid-gid.sh b/docker-entrypoint.d/100-uid-gid.sh deleted file mode 100644 index e6d266d0..00000000 --- a/docker-entrypoint.d/100-uid-gid.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - - -############################################################ -# Functions -############################################################ - -### -### Log to stdout/stderr -### -log() { - local type="${1}" # ok, warn or err - local message="${2}" # msg to print - - local clr_ok="\033[0;32m" - local clr_info="\033[0;34m" - local clr_warn="\033[0;33m" - local clr_err="\033[0;31m" - local clr_rst="\033[0m" - - if [ "${type}" = "warn" ]; then - printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - elif [ "${type}" = "err" ]; then - printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - else - printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr - fi -} - -### -### Is argument a positive integer? -### -isint() { - test -n "${1##*[!0-9]*}" -} - -### -### Helper -### -_get_username_by_uid() { - if getent="$( getent passwd "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} -_get_groupname_by_gid() { - if getent="$( getent group "${1}" )"; then - echo "${getent//:*}" - return 0 - fi - return 1 -} - - -### -### Change UID -### -set_uid() { - local uid="${1}" - local username="${2}" - local groupname="${3}" - - # spare UID to change another user to - local spare_uid=9876 - - if ! isint "${uid}"; then - log "err" "${uid} is not a valid UID" - exit 1 - else - # Username with this UID already exists - if target_username="$( _get_username_by_uid "${uid}" )"; then - # It is not our user, so we need to change their UID to something else first - if [ "${target_username}" != "${username}" ]; then - log "warn" "User with ${uid} already exists: ${target_username}" - usermod -u "${spare_uid}" "${target_username}" - fi - # UID not found, let's create a new user - else - useradd -M -u "${uid}" -s /bin/bash -g "${groupname}" "${username}" - return 0 - fi - usermod -u "${uid}" "${username}" - fi -} - - -### -### Change GID -### -set_gid() { - local gid="${1}" - local groupname="${2}" - - # spare GID to change another group to - local spare_gid=9876 - - if ! isint "${gid}"; then - log "err" "${gid} is not a valid GID" - exit 1 - else - # Groupname with this GID already exists - if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then - # It is not our group, so we need to change their GID to something else first - if [ "${target_groupname}" != "${groupname}" ]; then - log "warn" "Group with ${gid} already exists: ${target_groupname}" - groupmod -g "${spare_gid}" "${target_groupname}" - fi - # GID not found, let's create a new group - else - groupadd -g "${gid}" -r "${groupname}" - return 0 - fi - groupmod -g "${gid}" "${groupname}" - fi -} diff --git a/entrypoint-cli.sh b/entrypoint-cli.sh index 3fa15746..cbb41e45 100644 --- a/entrypoint-cli.sh +++ b/entrypoint-cli.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/entrypoint-php.sh b/entrypoint-php.sh index a8383695..5560f819 100644 --- a/entrypoint-php.sh +++ b/entrypoint-php.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec "$@" diff --git a/entrypoint-phpunit.sh b/entrypoint-phpunit.sh index 5e6ad370..3fbf79ae 100644 --- a/entrypoint-phpunit.sh +++ b/entrypoint-phpunit.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source /docker-entrypoint.d/100-uid-gid.sh - # If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled if [ "$LOCAL_PHP_XDEBUG" = true ]; then docker-php-ext-enable xdebug @@ -20,8 +18,8 @@ else fi ### Change UID/GID -set_gid "${PHP_FPM_GID}" "wp_php" -set_uid "${PHP_FPM_UID}" "wp_php" "wp_php" +usermod -o -u "${PHP_FPM_UID}" "wp_php" +groupmod -o -g "${PHP_FPM_GID}" "wp_php" # Execute CMD exec su wp_php -c "$@" diff --git a/update.php b/update.php index ca220b3d..7492bcd7 100644 --- a/update.php +++ b/update.php @@ -288,8 +288,6 @@ } - echo shell_exec( "cp -R docker-entrypoint.d $version/$image" ); - } elseif ( $image === 'phpunit' ) { // Replace tags inside the PHPUnit Dockerfile template. $dockerfile = str_replace( '%%PHPUNIT_VERSION%%', $config, $dockerfile ); From c313051ea8186884dfdee35b02480a383d7da381 Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 15:09:07 +1000 Subject: [PATCH 08/16] Remove a bit I missed. --- 5.2/php/Dockerfile | 1 - 5.3/php/Dockerfile | 1 - 5.4/php/Dockerfile | 1 - 5.5/php/Dockerfile | 1 - 5.6/php/Dockerfile | 1 - 7.0/php/Dockerfile | 1 - 7.1/php/Dockerfile | 1 - 7.2/php/Dockerfile | 1 - 7.3/php/Dockerfile | 1 - 7.4/php/Dockerfile | 1 - 8.0/php/Dockerfile | 1 - Dockerfile-php.template | 1 - 12 files changed, 12 deletions(-) diff --git a/5.2/php/Dockerfile b/5.2/php/Dockerfile index 3eebc908..76815c15 100644 --- a/5.2/php/Dockerfile +++ b/5.2/php/Dockerfile @@ -17,7 +17,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/5.3/php/Dockerfile b/5.3/php/Dockerfile index 1dc840f1..3fa24983 100644 --- a/5.3/php/Dockerfile +++ b/5.3/php/Dockerfile @@ -37,7 +37,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/5.4/php/Dockerfile b/5.4/php/Dockerfile index d0aa0552..ca30d4f9 100644 --- a/5.4/php/Dockerfile +++ b/5.4/php/Dockerfile @@ -48,7 +48,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/5.5/php/Dockerfile b/5.5/php/Dockerfile index 3f5895bb..906df475 100644 --- a/5.5/php/Dockerfile +++ b/5.5/php/Dockerfile @@ -48,7 +48,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/5.6/php/Dockerfile b/5.6/php/Dockerfile index 8fdf78a5..61b618bc 100644 --- a/5.6/php/Dockerfile +++ b/5.6/php/Dockerfile @@ -48,7 +48,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/7.0/php/Dockerfile b/7.0/php/Dockerfile index a312b8c2..5079697e 100644 --- a/7.0/php/Dockerfile +++ b/7.0/php/Dockerfile @@ -48,7 +48,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/7.1/php/Dockerfile b/7.1/php/Dockerfile index 29d891c6..cfacaa91 100644 --- a/7.1/php/Dockerfile +++ b/7.1/php/Dockerfile @@ -48,7 +48,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/7.2/php/Dockerfile b/7.2/php/Dockerfile index 06695a85..380fcea4 100644 --- a/7.2/php/Dockerfile +++ b/7.2/php/Dockerfile @@ -48,7 +48,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/7.3/php/Dockerfile b/7.3/php/Dockerfile index f7b26c0a..0e6875e0 100644 --- a/7.3/php/Dockerfile +++ b/7.3/php/Dockerfile @@ -48,7 +48,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/7.4/php/Dockerfile b/7.4/php/Dockerfile index 19ff221e..ae89a9bf 100644 --- a/7.4/php/Dockerfile +++ b/7.4/php/Dockerfile @@ -48,7 +48,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/8.0/php/Dockerfile b/8.0/php/Dockerfile index 50cbf714..54682730 100644 --- a/8.0/php/Dockerfile +++ b/8.0/php/Dockerfile @@ -39,7 +39,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/Dockerfile-php.template b/Dockerfile-php.template index 20921d89..86150282 100644 --- a/Dockerfile-php.template +++ b/Dockerfile-php.template @@ -13,7 +13,6 @@ COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ - chmod +x /docker-entrypoint.d/*.sh && \ groupadd -g 1000 -r wp_php && \ useradd -M -u 1000 -s /bin/bash -g wp_php wp_php From 9a8ba33b26bb3220fdb43d0c8c724faac0994204 Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 15:42:43 +1000 Subject: [PATCH 09/16] Tweaking the entrypoint scripts. --- 5.2/cli/entrypoint.sh | 18 ++++-------------- 5.2/php/entrypoint.sh | 4 ++-- 5.2/phpunit/entrypoint.sh | 7 ++++--- 5.3/cli/entrypoint.sh | 18 ++++-------------- 5.3/php/entrypoint.sh | 4 ++-- 5.3/phpunit/entrypoint.sh | 7 ++++--- 5.4/cli/entrypoint.sh | 18 ++++-------------- 5.4/php/entrypoint.sh | 4 ++-- 5.4/phpunit/entrypoint.sh | 7 ++++--- 5.5/cli/entrypoint.sh | 18 ++++-------------- 5.5/php/entrypoint.sh | 4 ++-- 5.5/phpunit/entrypoint.sh | 7 ++++--- 5.6/cli/entrypoint.sh | 18 ++++-------------- 5.6/php/entrypoint.sh | 4 ++-- 5.6/phpunit/entrypoint.sh | 7 ++++--- 7.0/cli/entrypoint.sh | 18 ++++-------------- 7.0/php/entrypoint.sh | 4 ++-- 7.0/phpunit/entrypoint.sh | 7 ++++--- 7.1/cli/entrypoint.sh | 18 ++++-------------- 7.1/php/entrypoint.sh | 4 ++-- 7.1/phpunit/entrypoint.sh | 7 ++++--- 7.2/cli/entrypoint.sh | 18 ++++-------------- 7.2/php/entrypoint.sh | 4 ++-- 7.2/phpunit/entrypoint.sh | 7 ++++--- 7.3/cli/entrypoint.sh | 18 ++++-------------- 7.3/php/entrypoint.sh | 4 ++-- 7.3/phpunit/entrypoint.sh | 7 ++++--- 7.4/cli/entrypoint.sh | 18 ++++-------------- 7.4/php/entrypoint.sh | 4 ++-- 7.4/phpunit/entrypoint.sh | 7 ++++--- 8.0/cli/entrypoint.sh | 18 ++++-------------- 8.0/php/entrypoint.sh | 4 ++-- 8.0/phpunit/entrypoint.sh | 7 ++++--- entrypoint-cli.sh | 18 ++++-------------- entrypoint-php.sh | 4 ++-- entrypoint-phpunit.sh | 7 ++++--- 36 files changed, 120 insertions(+), 228 deletions(-) diff --git a/5.2/cli/entrypoint.sh b/5.2/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/5.2/cli/entrypoint.sh +++ b/5.2/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.2/php/entrypoint.sh b/5.2/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/5.2/php/entrypoint.sh +++ b/5.2/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/5.2/phpunit/entrypoint.sh b/5.2/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/5.2/phpunit/entrypoint.sh +++ b/5.2/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.3/cli/entrypoint.sh b/5.3/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/5.3/cli/entrypoint.sh +++ b/5.3/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.3/php/entrypoint.sh b/5.3/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/5.3/php/entrypoint.sh +++ b/5.3/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/5.3/phpunit/entrypoint.sh b/5.3/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/5.3/phpunit/entrypoint.sh +++ b/5.3/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.4/cli/entrypoint.sh b/5.4/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/5.4/cli/entrypoint.sh +++ b/5.4/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.4/php/entrypoint.sh b/5.4/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/5.4/php/entrypoint.sh +++ b/5.4/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/5.4/phpunit/entrypoint.sh b/5.4/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/5.4/phpunit/entrypoint.sh +++ b/5.4/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.5/cli/entrypoint.sh b/5.5/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/5.5/cli/entrypoint.sh +++ b/5.5/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.5/php/entrypoint.sh b/5.5/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/5.5/php/entrypoint.sh +++ b/5.5/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/5.5/phpunit/entrypoint.sh b/5.5/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/5.5/phpunit/entrypoint.sh +++ b/5.5/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.6/cli/entrypoint.sh b/5.6/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/5.6/cli/entrypoint.sh +++ b/5.6/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/5.6/php/entrypoint.sh b/5.6/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/5.6/php/entrypoint.sh +++ b/5.6/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/5.6/phpunit/entrypoint.sh b/5.6/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/5.6/phpunit/entrypoint.sh +++ b/5.6/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.0/cli/entrypoint.sh b/7.0/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/7.0/cli/entrypoint.sh +++ b/7.0/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.0/php/entrypoint.sh b/7.0/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/7.0/php/entrypoint.sh +++ b/7.0/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/7.0/phpunit/entrypoint.sh b/7.0/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/7.0/phpunit/entrypoint.sh +++ b/7.0/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.1/cli/entrypoint.sh b/7.1/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/7.1/cli/entrypoint.sh +++ b/7.1/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.1/php/entrypoint.sh b/7.1/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/7.1/php/entrypoint.sh +++ b/7.1/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/7.1/phpunit/entrypoint.sh b/7.1/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/7.1/phpunit/entrypoint.sh +++ b/7.1/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.2/cli/entrypoint.sh b/7.2/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/7.2/cli/entrypoint.sh +++ b/7.2/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.2/php/entrypoint.sh b/7.2/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/7.2/php/entrypoint.sh +++ b/7.2/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/7.2/phpunit/entrypoint.sh b/7.2/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/7.2/phpunit/entrypoint.sh +++ b/7.2/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.3/cli/entrypoint.sh b/7.3/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/7.3/cli/entrypoint.sh +++ b/7.3/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.3/php/entrypoint.sh b/7.3/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/7.3/php/entrypoint.sh +++ b/7.3/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/7.3/phpunit/entrypoint.sh b/7.3/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/7.3/phpunit/entrypoint.sh +++ b/7.3/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.4/cli/entrypoint.sh b/7.4/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/7.4/cli/entrypoint.sh +++ b/7.4/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/7.4/php/entrypoint.sh b/7.4/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/7.4/php/entrypoint.sh +++ b/7.4/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/7.4/phpunit/entrypoint.sh b/7.4/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/7.4/phpunit/entrypoint.sh +++ b/7.4/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/8.0/cli/entrypoint.sh b/8.0/cli/entrypoint.sh index cbb41e45..b2852d26 100644 --- a/8.0/cli/entrypoint.sh +++ b/8.0/cli/entrypoint.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/8.0/php/entrypoint.sh b/8.0/php/entrypoint.sh index 5560f819..79d4e274 100755 --- a/8.0/php/entrypoint.sh +++ b/8.0/php/entrypoint.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/8.0/phpunit/entrypoint.sh b/8.0/phpunit/entrypoint.sh index 3fbf79ae..b2852d26 100644 --- a/8.0/phpunit/entrypoint.sh +++ b/8.0/phpunit/entrypoint.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/entrypoint-cli.sh b/entrypoint-cli.sh index cbb41e45..b2852d26 100644 --- a/entrypoint-cli.sh +++ b/entrypoint-cli.sh @@ -18,19 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- wp "$@" -fi - -# 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 wp --path=/dev/null help "$1" > /dev/null 2>&1; then - set -- wp "$@" -fi +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + diff --git a/entrypoint-php.sh b/entrypoint-php.sh index 5560f819..79d4e274 100644 --- a/entrypoint-php.sh +++ b/entrypoint-php.sh @@ -18,8 +18,8 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD exec "$@" diff --git a/entrypoint-phpunit.sh b/entrypoint-phpunit.sh index 3fbf79ae..b2852d26 100644 --- a/entrypoint-phpunit.sh +++ b/entrypoint-phpunit.sh @@ -18,8 +18,9 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID}" "wp_php" -groupmod -o -g "${PHP_FPM_GID}" "wp_php" +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -exec su wp_php -c "$@" +su -m wp_php -c '"$0" "$@"' -- "$@" + From 83c573119b4e804a38208c96813cf5e7ded2e9c5 Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 16:23:40 +1000 Subject: [PATCH 10/16] Make WP-CLI commands work when passed. --- 5.2/cli/entrypoint.sh | 13 +++++++++++-- 5.2/php/Dockerfile | 7 ++++++- 5.2/phpunit/entrypoint.sh | 3 +-- 5.3/cli/entrypoint.sh | 13 +++++++++++-- 5.3/php/Dockerfile | 2 +- 5.3/phpunit/entrypoint.sh | 3 +-- 5.4/cli/entrypoint.sh | 13 +++++++++++-- 5.4/php/Dockerfile | 2 +- 5.4/phpunit/entrypoint.sh | 3 +-- 5.5/cli/entrypoint.sh | 13 +++++++++++-- 5.5/php/Dockerfile | 2 +- 5.5/phpunit/entrypoint.sh | 3 +-- 5.6/cli/entrypoint.sh | 13 +++++++++++-- 5.6/php/Dockerfile | 2 +- 5.6/phpunit/entrypoint.sh | 3 +-- 7.0/cli/entrypoint.sh | 13 +++++++++++-- 7.0/php/Dockerfile | 2 +- 7.0/phpunit/entrypoint.sh | 3 +-- 7.1/cli/entrypoint.sh | 13 +++++++++++-- 7.1/php/Dockerfile | 2 +- 7.1/phpunit/entrypoint.sh | 3 +-- 7.2/cli/entrypoint.sh | 13 +++++++++++-- 7.2/php/Dockerfile | 2 +- 7.2/phpunit/entrypoint.sh | 3 +-- 7.3/cli/entrypoint.sh | 13 +++++++++++-- 7.3/php/Dockerfile | 2 +- 7.3/phpunit/entrypoint.sh | 3 +-- 7.4/cli/entrypoint.sh | 13 +++++++++++-- 7.4/php/Dockerfile | 2 +- 7.4/phpunit/entrypoint.sh | 3 +-- 8.0/cli/entrypoint.sh | 13 +++++++++++-- 8.0/php/Dockerfile | 2 +- 8.0/phpunit/entrypoint.sh | 3 +-- entrypoint-cli.sh | 13 +++++++++++-- entrypoint-phpunit.sh | 3 +-- update.php | 22 +++++++++++----------- 36 files changed, 171 insertions(+), 70 deletions(-) diff --git a/5.2/cli/entrypoint.sh b/5.2/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/5.2/cli/entrypoint.sh +++ b/5.2/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/5.2/php/Dockerfile b/5.2/php/Dockerfile index 76815c15..b5211e78 100644 --- a/5.2/php/Dockerfile +++ b/5.2/php/Dockerfile @@ -11,7 +11,12 @@ WORKDIR /var/www ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /tmp - +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends sudo; COPY entrypoint.sh /entrypoint.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf diff --git a/5.2/phpunit/entrypoint.sh b/5.2/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/5.2/phpunit/entrypoint.sh +++ b/5.2/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/5.3/cli/entrypoint.sh b/5.3/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/5.3/cli/entrypoint.sh +++ b/5.3/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/5.3/php/Dockerfile b/5.3/php/Dockerfile index 3fa24983..482f2855 100644 --- a/5.3/php/Dockerfile +++ b/5.3/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends unzip; \ + apt-get install -y --no-install-recommends unzip sudo; \ \ curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ diff --git a/5.3/phpunit/entrypoint.sh b/5.3/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/5.3/phpunit/entrypoint.sh +++ b/5.3/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/5.4/cli/entrypoint.sh b/5.4/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/5.4/cli/entrypoint.sh +++ b/5.4/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/5.4/php/Dockerfile b/5.4/php/Dockerfile index ca30d4f9..16c6d6a7 100644 --- a/5.4/php/Dockerfile +++ b/5.4/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libicu-dev libonig-dev locales; \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libicu-dev libonig-dev locales sudo; \ sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ locale-gen; \ \ diff --git a/5.4/phpunit/entrypoint.sh b/5.4/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/5.4/phpunit/entrypoint.sh +++ b/5.4/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/5.5/cli/entrypoint.sh b/5.5/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/5.5/cli/entrypoint.sh +++ b/5.5/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/5.5/php/Dockerfile b/5.5/php/Dockerfile index 906df475..ddb550f2 100644 --- a/5.5/php/Dockerfile +++ b/5.5/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libicu-dev libonig-dev locales; \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libicu-dev libonig-dev locales sudo; \ sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ locale-gen; \ \ diff --git a/5.5/phpunit/entrypoint.sh b/5.5/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/5.5/phpunit/entrypoint.sh +++ b/5.5/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/5.6/cli/entrypoint.sh b/5.6/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/5.6/cli/entrypoint.sh +++ b/5.6/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/5.6/php/Dockerfile b/5.6/php/Dockerfile index 61b618bc..5de2de17 100644 --- a/5.6/php/Dockerfile +++ b/5.6/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales; \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ locale-gen; \ \ diff --git a/5.6/phpunit/entrypoint.sh b/5.6/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/5.6/phpunit/entrypoint.sh +++ b/5.6/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/7.0/cli/entrypoint.sh b/7.0/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/7.0/cli/entrypoint.sh +++ b/7.0/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/7.0/php/Dockerfile b/7.0/php/Dockerfile index 5079697e..b8484e13 100644 --- a/7.0/php/Dockerfile +++ b/7.0/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales; \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ locale-gen; \ \ diff --git a/7.0/phpunit/entrypoint.sh b/7.0/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/7.0/phpunit/entrypoint.sh +++ b/7.0/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/7.1/cli/entrypoint.sh b/7.1/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/7.1/cli/entrypoint.sh +++ b/7.1/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/7.1/php/Dockerfile b/7.1/php/Dockerfile index cfacaa91..7182c7bc 100644 --- a/7.1/php/Dockerfile +++ b/7.1/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales; \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ locale-gen; \ \ diff --git a/7.1/phpunit/entrypoint.sh b/7.1/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/7.1/phpunit/entrypoint.sh +++ b/7.1/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/7.2/cli/entrypoint.sh b/7.2/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/7.2/cli/entrypoint.sh +++ b/7.2/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/7.2/php/Dockerfile b/7.2/php/Dockerfile index 380fcea4..3d48fbaa 100644 --- a/7.2/php/Dockerfile +++ b/7.2/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales; \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ locale-gen; \ \ diff --git a/7.2/phpunit/entrypoint.sh b/7.2/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/7.2/phpunit/entrypoint.sh +++ b/7.2/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/7.3/cli/entrypoint.sh b/7.3/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/7.3/cli/entrypoint.sh +++ b/7.3/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/7.3/php/Dockerfile b/7.3/php/Dockerfile index 0e6875e0..8e8ea569 100644 --- a/7.3/php/Dockerfile +++ b/7.3/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales; \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ locale-gen; \ \ diff --git a/7.3/phpunit/entrypoint.sh b/7.3/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/7.3/phpunit/entrypoint.sh +++ b/7.3/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/7.4/cli/entrypoint.sh b/7.4/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/7.4/cli/entrypoint.sh +++ b/7.4/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/7.4/php/Dockerfile b/7.4/php/Dockerfile index ae89a9bf..054e3071 100644 --- a/7.4/php/Dockerfile +++ b/7.4/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales; \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ locale-gen; \ \ diff --git a/7.4/phpunit/entrypoint.sh b/7.4/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/7.4/phpunit/entrypoint.sh +++ b/7.4/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/8.0/cli/entrypoint.sh b/8.0/cli/entrypoint.sh index b2852d26..e78162a1 100644 --- a/8.0/cli/entrypoint.sh +++ b/8.0/cli/entrypoint.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/8.0/php/Dockerfile b/8.0/php/Dockerfile index 54682730..403f4a9f 100644 --- a/8.0/php/Dockerfile +++ b/8.0/php/Dockerfile @@ -16,7 +16,7 @@ RUN set -ex; \ \ apt-get update; \ \ - apt-get install -y --no-install-recommends unzip; \ + apt-get install -y --no-install-recommends unzip sudo; \ \ docker-php-ext-install mysqli; \ \ diff --git a/8.0/phpunit/entrypoint.sh b/8.0/phpunit/entrypoint.sh index b2852d26..750cd2e4 100644 --- a/8.0/phpunit/entrypoint.sh +++ b/8.0/phpunit/entrypoint.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/entrypoint-cli.sh b/entrypoint-cli.sh index b2852d26..e78162a1 100644 --- a/entrypoint-cli.sh +++ b/entrypoint-cli.sh @@ -21,6 +21,15 @@ fi usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" -# Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- wp "$@" +fi +# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead +if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then + set -- wp "$@" +fi + +# Execute CMD +sudo -u wp_php "$@" diff --git a/entrypoint-phpunit.sh b/entrypoint-phpunit.sh index b2852d26..750cd2e4 100644 --- a/entrypoint-phpunit.sh +++ b/entrypoint-phpunit.sh @@ -22,5 +22,4 @@ usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" # Execute CMD -su -m wp_php -c '"$0" "$@"' -- "$@" - +sudo -u wp_php "$@" diff --git a/update.php b/update.php index 7492bcd7..af034f88 100644 --- a/update.php +++ b/update.php @@ -26,7 +26,7 @@ '5.2' => array( 'php' => array( 'base_name' => 'devilbox/php-fpm-5.2:latest', - 'apt' => array(), + 'apt' => array( 'sudo' ), 'extensions' => array(), 'pecl_extensions' => array(), 'composer' => false, @@ -37,7 +37,7 @@ '5.3' => array( 'php' => array( 'base_name' => 'devilbox/php-fpm-5.3:latest', - 'apt' => array( 'unzip' ), + 'apt' => array( 'unzip', 'sudo' ), 'extensions' => array(), 'pecl_extensions' => array(), 'composer' => true, @@ -51,7 +51,7 @@ '5.4' => array( 'php' => array( 'base_name' => 'php:5.4-fpm', - 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libicu-dev', 'libonig-dev', 'locales' ), + 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libicu-dev', 'libonig-dev', 'locales', 'sudo' ), 'extensions' => array( 'gd', 'mysql', 'mysqli', 'zip', 'exif', 'intl', 'mbstring' ), 'pecl_extensions' => array( 'xdebug-2.4.1', 'memcached-2.2.0', 'imagick-3.4.4' ), 'composer' => true, @@ -65,7 +65,7 @@ '5.5' => array( 'php' => array( 'base_name' => 'php:5.5-fpm', - 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libicu-dev', 'libonig-dev', 'locales' ), + 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libicu-dev', 'libonig-dev', 'locales', 'sudo' ), 'extensions' => array( 'gd', 'mysql', 'mysqli', 'zip', 'exif', 'intl', 'mbstring' ), 'pecl_extensions' => array( 'xdebug-2.5.5', 'memcached-2.2.0', 'imagick-3.4.4' ), 'composer' => true, @@ -79,7 +79,7 @@ '5.6' => array( 'php' => array( 'base_name' => 'php:5.6-fpm', - 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales' ), + 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales', 'sudo' ), 'extensions' => array( 'gd', 'mysql', 'mysqli', 'zip', 'exif', 'intl', 'mbstring' ), 'pecl_extensions' => array( 'xdebug-2.5.5', 'memcached-2.2.0', 'imagick-3.4.4' ), 'composer' => true, @@ -93,7 +93,7 @@ '7.0' => array( 'php' => array( 'base_name' => 'php:7.0-fpm', - 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales' ), + 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales', 'sudo' ), 'extensions' => array( 'gd', 'opcache', 'mysqli', 'zip', 'exif', 'intl', 'mbstring' ), 'pecl_extensions' => array( 'xdebug-2.7.2', 'memcached-3.1.3', 'imagick' ), 'composer' => true, @@ -107,7 +107,7 @@ '7.1' => array( 'php' => array( 'base_name' => 'php:7.1-fpm', - 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales' ), + 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales', 'sudo' ), 'extensions' => array( 'gd', 'opcache', 'mysqli', 'zip', 'exif', 'intl', 'mbstring' ), 'pecl_extensions' => array( 'xdebug-2.7.2', 'memcached-3.1.3', 'imagick' ), 'composer' => true, @@ -121,7 +121,7 @@ '7.2' => array( 'php' => array( 'base_name' => 'php:7.2-fpm', - 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales' ), + 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales', 'sudo' ), 'extensions' => array( 'gd', 'opcache', 'mysqli', 'zip', 'exif', 'intl', 'mbstring' ), 'pecl_extensions' => array( 'xdebug-2.7.2', 'memcached-3.1.3', 'imagick' ), 'composer' => true, @@ -135,7 +135,7 @@ '7.3' => array( 'php' => array( 'base_name' => 'php:7.3-fpm', - 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales' ), + 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales', 'sudo' ), 'extensions' => array( 'gd', 'opcache', 'mysqli', 'zip', 'exif', 'intl', 'mbstring' ), 'pecl_extensions' => array( 'xdebug-2.7.2', 'memcached-3.1.3', 'imagick' ), 'composer' => true, @@ -149,7 +149,7 @@ '7.4' => array( 'php' => array( 'base_name' => 'php:7.4-rc-fpm', - 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales' ), + 'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales', 'sudo' ), 'extensions' => array( 'gd', 'opcache', 'mysqli', 'zip', 'exif', 'intl', 'mbstring' ), 'pecl_extensions' => array( 'xdebug-2.8.0beta1', 'memcached-3.1.3', 'imagick' ), 'composer' => true, @@ -163,7 +163,7 @@ '8.0' => array( 'php' => array( 'base_name' => 'devilbox/php-fpm-8.0:latest', - 'apt' => array( 'unzip' ), + 'apt' => array( 'unzip', 'sudo' ), 'extensions' => array( 'mysqli' ), 'pecl_extensions' => array(), 'composer' => true, From 4a0006dadb08e20b624eb6a1846a2de6b452e3eb Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 25 Sep 2019 17:10:26 +1000 Subject: [PATCH 11/16] Create the user directory, so WP-CLI has somewhere to put its cache. --- 5.2/php/Dockerfile | 2 +- 5.3/php/Dockerfile | 2 +- 5.4/php/Dockerfile | 2 +- 5.5/php/Dockerfile | 2 +- 5.6/php/Dockerfile | 2 +- 7.0/php/Dockerfile | 2 +- 7.1/php/Dockerfile | 2 +- 7.2/php/Dockerfile | 2 +- 7.3/php/Dockerfile | 2 +- 7.4/php/Dockerfile | 2 +- 8.0/php/Dockerfile | 2 +- Dockerfile-php.template | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/5.2/php/Dockerfile b/5.2/php/Dockerfile index b5211e78..d770ab4d 100644 --- a/5.2/php/Dockerfile +++ b/5.2/php/Dockerfile @@ -23,7 +23,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.3/php/Dockerfile b/5.3/php/Dockerfile index 482f2855..118ab9d1 100644 --- a/5.3/php/Dockerfile +++ b/5.3/php/Dockerfile @@ -38,7 +38,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.4/php/Dockerfile b/5.4/php/Dockerfile index 16c6d6a7..ff1cf07e 100644 --- a/5.4/php/Dockerfile +++ b/5.4/php/Dockerfile @@ -49,7 +49,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.5/php/Dockerfile b/5.5/php/Dockerfile index ddb550f2..2aa69c36 100644 --- a/5.5/php/Dockerfile +++ b/5.5/php/Dockerfile @@ -49,7 +49,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/5.6/php/Dockerfile b/5.6/php/Dockerfile index 5de2de17..02268a09 100644 --- a/5.6/php/Dockerfile +++ b/5.6/php/Dockerfile @@ -49,7 +49,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.0/php/Dockerfile b/7.0/php/Dockerfile index b8484e13..40367a62 100644 --- a/7.0/php/Dockerfile +++ b/7.0/php/Dockerfile @@ -49,7 +49,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.1/php/Dockerfile b/7.1/php/Dockerfile index 7182c7bc..92871add 100644 --- a/7.1/php/Dockerfile +++ b/7.1/php/Dockerfile @@ -49,7 +49,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.2/php/Dockerfile b/7.2/php/Dockerfile index 3d48fbaa..a66ada10 100644 --- a/7.2/php/Dockerfile +++ b/7.2/php/Dockerfile @@ -49,7 +49,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.3/php/Dockerfile b/7.3/php/Dockerfile index 8e8ea569..7ac1e96b 100644 --- a/7.3/php/Dockerfile +++ b/7.3/php/Dockerfile @@ -49,7 +49,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.4/php/Dockerfile b/7.4/php/Dockerfile index 054e3071..b74b68ad 100644 --- a/7.4/php/Dockerfile +++ b/7.4/php/Dockerfile @@ -49,7 +49,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/8.0/php/Dockerfile b/8.0/php/Dockerfile index 403f4a9f..60670ca0 100644 --- a/8.0/php/Dockerfile +++ b/8.0/php/Dockerfile @@ -40,7 +40,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/Dockerfile-php.template b/Dockerfile-php.template index 86150282..ff939fdf 100644 --- a/Dockerfile-php.template +++ b/Dockerfile-php.template @@ -14,7 +14,7 @@ COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ groupadd -g 1000 -r wp_php && \ - useradd -M -u 1000 -s /bin/bash -g wp_php wp_php + useradd -u 1000 -s /bin/bash -g wp_php wp_php ENTRYPOINT [ "/entrypoint.sh" ] From 04748c4369541a2a7daa994d7270be3bf04cc3c6 Mon Sep 17 00:00:00 2001 From: Gary Date: Thu, 26 Sep 2019 11:07:31 +1000 Subject: [PATCH 12/16] Clean up the root directory. --- .travis.yml | 69 ++++++++++--------- 5.2/php/Dockerfile | 30 -------- 5.3/php/Dockerfile | 45 ------------ 5.4/php/Dockerfile | 56 --------------- 5.5/php/Dockerfile | 56 --------------- 5.6/php/Dockerfile | 56 --------------- 7.0/php/Dockerfile | 56 --------------- 7.1/php/Dockerfile | 56 --------------- 7.2/php/Dockerfile | 56 --------------- 7.3/php/Dockerfile | 56 --------------- 7.4/php/Dockerfile | 56 --------------- 8.0/php/Dockerfile | 47 ------------- php-fpm-php.conf => config/php-fpm-php.conf | 0 .../entrypoint-cli.sh | 0 .../entrypoint-php.sh | 0 .../entrypoint-phpunit.sh | 0 {5.2 => images/5.2}/cli/Dockerfile | 3 +- {5.2 => images/5.2}/cli/entrypoint.sh | 0 images/5.2/php/Dockerfile | 0 {5.2 => images/5.2}/php/entrypoint.sh | 0 {5.2 => images/5.2}/php/php-fpm.conf | 0 {5.2 => images/5.2}/phpunit/Dockerfile | 3 +- {5.2 => images/5.2}/phpunit/entrypoint.sh | 0 {5.3 => images/5.3}/cli/Dockerfile | 3 +- {5.3 => images/5.3}/cli/entrypoint.sh | 0 images/5.3/php/Dockerfile | 0 {5.3 => images/5.3}/php/entrypoint.sh | 0 {5.3 => images/5.3}/php/php-fpm.conf | 0 {5.3 => images/5.3}/phpunit/Dockerfile | 3 +- {5.3 => images/5.3}/phpunit/entrypoint.sh | 0 {5.4 => images/5.4}/cli/Dockerfile | 3 +- {5.4 => images/5.4}/cli/entrypoint.sh | 0 images/5.4/php/Dockerfile | 0 {5.4 => images/5.4}/php/entrypoint.sh | 0 {5.4 => images/5.4}/php/php-fpm.conf | 0 {5.4 => images/5.4}/phpunit/Dockerfile | 3 +- {5.4 => images/5.4}/phpunit/entrypoint.sh | 0 {5.5 => images/5.5}/cli/Dockerfile | 3 +- {5.5 => images/5.5}/cli/entrypoint.sh | 0 images/5.5/php/Dockerfile | 0 {5.5 => images/5.5}/php/entrypoint.sh | 0 {5.5 => images/5.5}/php/php-fpm.conf | 0 {5.5 => images/5.5}/phpunit/Dockerfile | 3 +- {5.5 => images/5.5}/phpunit/entrypoint.sh | 0 {5.6 => images/5.6}/cli/Dockerfile | 3 +- {5.6 => images/5.6}/cli/entrypoint.sh | 0 images/5.6/php/Dockerfile | 0 {5.6 => images/5.6}/php/entrypoint.sh | 0 {5.6 => images/5.6}/php/php-fpm.conf | 0 {5.6 => images/5.6}/phpunit/Dockerfile | 3 +- {5.6 => images/5.6}/phpunit/entrypoint.sh | 0 {7.0 => images/7.0}/cli/Dockerfile | 3 +- {7.0 => images/7.0}/cli/entrypoint.sh | 0 images/7.0/php/Dockerfile | 0 {7.0 => images/7.0}/php/entrypoint.sh | 0 {7.0 => images/7.0}/php/php-fpm.conf | 0 {7.0 => images/7.0}/phpunit/Dockerfile | 3 +- {7.0 => images/7.0}/phpunit/entrypoint.sh | 0 {7.1 => images/7.1}/cli/Dockerfile | 3 +- {7.1 => images/7.1}/cli/entrypoint.sh | 0 images/7.1/php/Dockerfile | 0 {7.1 => images/7.1}/php/entrypoint.sh | 0 {7.1 => images/7.1}/php/php-fpm.conf | 0 {7.1 => images/7.1}/phpunit/Dockerfile | 3 +- {7.1 => images/7.1}/phpunit/entrypoint.sh | 0 {7.2 => images/7.2}/cli/Dockerfile | 3 +- {7.2 => images/7.2}/cli/entrypoint.sh | 0 images/7.2/php/Dockerfile | 0 {7.2 => images/7.2}/php/entrypoint.sh | 0 {7.2 => images/7.2}/php/php-fpm.conf | 0 {7.2 => images/7.2}/phpunit/Dockerfile | 3 +- {7.2 => images/7.2}/phpunit/entrypoint.sh | 0 {7.3 => images/7.3}/cli/Dockerfile | 3 +- {7.3 => images/7.3}/cli/entrypoint.sh | 0 images/7.3/php/Dockerfile | 0 {7.3 => images/7.3}/php/entrypoint.sh | 0 {7.3 => images/7.3}/php/php-fpm.conf | 0 {7.3 => images/7.3}/phpunit/Dockerfile | 3 +- {7.3 => images/7.3}/phpunit/entrypoint.sh | 0 {7.4 => images/7.4}/cli/Dockerfile | 3 +- {7.4 => images/7.4}/cli/entrypoint.sh | 0 images/7.4/php/Dockerfile | 0 {7.4 => images/7.4}/php/entrypoint.sh | 0 {7.4 => images/7.4}/php/php-fpm.conf | 0 {7.4 => images/7.4}/phpunit/Dockerfile | 3 +- {7.4 => images/7.4}/phpunit/entrypoint.sh | 0 {8.0 => images/8.0}/cli/Dockerfile | 3 +- {8.0 => images/8.0}/cli/entrypoint.sh | 0 images/8.0/php/Dockerfile | 0 {8.0 => images/8.0}/php/entrypoint.sh | 0 {8.0 => images/8.0}/php/php-fpm.conf | 0 {8.0 => images/8.0}/phpunit/Dockerfile | 3 +- {8.0 => images/8.0}/phpunit/entrypoint.sh | 0 .../.travis.yml-template | 0 .../Dockerfile-cli.template | 0 .../Dockerfile-php.template | 0 .../Dockerfile-phpunit.template | 0 update.php | 25 +++---- 98 files changed, 92 insertions(+), 638 deletions(-) delete mode 100644 5.2/php/Dockerfile delete mode 100644 5.3/php/Dockerfile delete mode 100644 5.4/php/Dockerfile delete mode 100644 5.5/php/Dockerfile delete mode 100644 5.6/php/Dockerfile delete mode 100644 7.0/php/Dockerfile delete mode 100644 7.1/php/Dockerfile delete mode 100644 7.2/php/Dockerfile delete mode 100644 7.3/php/Dockerfile delete mode 100644 7.4/php/Dockerfile delete mode 100644 8.0/php/Dockerfile rename php-fpm-php.conf => config/php-fpm-php.conf (100%) rename entrypoint-cli.sh => entrypoint/entrypoint-cli.sh (100%) rename entrypoint-php.sh => entrypoint/entrypoint-php.sh (100%) rename entrypoint-phpunit.sh => entrypoint/entrypoint-phpunit.sh (100%) rename {5.2 => images/5.2}/cli/Dockerfile (71%) rename {5.2 => images/5.2}/cli/entrypoint.sh (100%) create mode 100644 images/5.2/php/Dockerfile rename {5.2 => images/5.2}/php/entrypoint.sh (100%) rename {5.2 => images/5.2}/php/php-fpm.conf (100%) rename {5.2 => images/5.2}/phpunit/Dockerfile (78%) rename {5.2 => images/5.2}/phpunit/entrypoint.sh (100%) rename {5.3 => images/5.3}/cli/Dockerfile (84%) rename {5.3 => images/5.3}/cli/entrypoint.sh (100%) create mode 100644 images/5.3/php/Dockerfile rename {5.3 => images/5.3}/php/entrypoint.sh (100%) rename {5.3 => images/5.3}/php/php-fpm.conf (100%) rename {5.3 => images/5.3}/phpunit/Dockerfile (78%) rename {5.3 => images/5.3}/phpunit/entrypoint.sh (100%) rename {5.4 => images/5.4}/cli/Dockerfile (84%) rename {5.4 => images/5.4}/cli/entrypoint.sh (100%) create mode 100644 images/5.4/php/Dockerfile rename {5.4 => images/5.4}/php/entrypoint.sh (100%) rename {5.4 => images/5.4}/php/php-fpm.conf (100%) rename {5.4 => images/5.4}/phpunit/Dockerfile (78%) rename {5.4 => images/5.4}/phpunit/entrypoint.sh (100%) rename {5.5 => images/5.5}/cli/Dockerfile (84%) rename {5.5 => images/5.5}/cli/entrypoint.sh (100%) create mode 100644 images/5.5/php/Dockerfile rename {5.5 => images/5.5}/php/entrypoint.sh (100%) rename {5.5 => images/5.5}/php/php-fpm.conf (100%) rename {5.5 => images/5.5}/phpunit/Dockerfile (78%) rename {5.5 => images/5.5}/phpunit/entrypoint.sh (100%) rename {5.6 => images/5.6}/cli/Dockerfile (84%) rename {5.6 => images/5.6}/cli/entrypoint.sh (100%) create mode 100644 images/5.6/php/Dockerfile rename {5.6 => images/5.6}/php/entrypoint.sh (100%) rename {5.6 => images/5.6}/php/php-fpm.conf (100%) rename {5.6 => images/5.6}/phpunit/Dockerfile (78%) rename {5.6 => images/5.6}/phpunit/entrypoint.sh (100%) rename {7.0 => images/7.0}/cli/Dockerfile (84%) rename {7.0 => images/7.0}/cli/entrypoint.sh (100%) create mode 100644 images/7.0/php/Dockerfile rename {7.0 => images/7.0}/php/entrypoint.sh (100%) rename {7.0 => images/7.0}/php/php-fpm.conf (100%) rename {7.0 => images/7.0}/phpunit/Dockerfile (78%) rename {7.0 => images/7.0}/phpunit/entrypoint.sh (100%) rename {7.1 => images/7.1}/cli/Dockerfile (84%) rename {7.1 => images/7.1}/cli/entrypoint.sh (100%) create mode 100644 images/7.1/php/Dockerfile rename {7.1 => images/7.1}/php/entrypoint.sh (100%) rename {7.1 => images/7.1}/php/php-fpm.conf (100%) rename {7.1 => images/7.1}/phpunit/Dockerfile (78%) rename {7.1 => images/7.1}/phpunit/entrypoint.sh (100%) rename {7.2 => images/7.2}/cli/Dockerfile (84%) rename {7.2 => images/7.2}/cli/entrypoint.sh (100%) create mode 100644 images/7.2/php/Dockerfile rename {7.2 => images/7.2}/php/entrypoint.sh (100%) rename {7.2 => images/7.2}/php/php-fpm.conf (100%) rename {7.2 => images/7.2}/phpunit/Dockerfile (78%) rename {7.2 => images/7.2}/phpunit/entrypoint.sh (100%) rename {7.3 => images/7.3}/cli/Dockerfile (84%) rename {7.3 => images/7.3}/cli/entrypoint.sh (100%) create mode 100644 images/7.3/php/Dockerfile rename {7.3 => images/7.3}/php/entrypoint.sh (100%) rename {7.3 => images/7.3}/php/php-fpm.conf (100%) rename {7.3 => images/7.3}/phpunit/Dockerfile (78%) rename {7.3 => images/7.3}/phpunit/entrypoint.sh (100%) rename {7.4 => images/7.4}/cli/Dockerfile (84%) rename {7.4 => images/7.4}/cli/entrypoint.sh (100%) create mode 100644 images/7.4/php/Dockerfile rename {7.4 => images/7.4}/php/entrypoint.sh (100%) rename {7.4 => images/7.4}/php/php-fpm.conf (100%) rename {7.4 => images/7.4}/phpunit/Dockerfile (78%) rename {7.4 => images/7.4}/phpunit/entrypoint.sh (100%) rename {8.0 => images/8.0}/cli/Dockerfile (84%) rename {8.0 => images/8.0}/cli/entrypoint.sh (100%) create mode 100644 images/8.0/php/Dockerfile rename {8.0 => images/8.0}/php/entrypoint.sh (100%) rename {8.0 => images/8.0}/php/php-fpm.conf (100%) rename {8.0 => images/8.0}/phpunit/Dockerfile (78%) rename {8.0 => images/8.0}/phpunit/entrypoint.sh (100%) rename .travis.yml-template => templates/.travis.yml-template (100%) rename Dockerfile-cli.template => templates/Dockerfile-cli.template (100%) rename Dockerfile-php.template => templates/Dockerfile-php.template (100%) rename Dockerfile-phpunit.template => templates/Dockerfile-phpunit.template (100%) diff --git a/.travis.yml b/.travis.yml index 56911826..d3c20d32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # if: tag IS blank @@ -40,173 +41,173 @@ jobs: - stage: "Build base PHP images" name: "php 5.2" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG 5.2/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG images/5.2/php - docker images - docker push $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG - name: "php 5.3" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG 5.3/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG images/5.3/php - docker images - docker push $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG - name: "php 5.4" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG 5.4/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG images/5.4/php - docker images - docker push $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG - name: "php 5.5" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG 5.5/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG images/5.5/php - docker images - docker push $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG - name: "php 5.6" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG 5.6/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG images/5.6/php - docker images - docker push $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG - name: "php 7.0" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG 7.0/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG images/7.0/php - docker images - docker push $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG - name: "php 7.1" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG 7.1/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG images/7.1/php - docker images - docker push $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG - name: "php 7.2" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG 7.2/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG images/7.2/php - docker images - docker push $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG - name: "php 7.3" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/php:latest$PR_TAG 7.3/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/php:latest$PR_TAG images/7.3/php - docker images - docker push $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG - docker push $PACKAGE_REGISTRY/php:latest$PR_TAG - name: "php 7.4" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG 7.4/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG images/7.4/php - docker images - docker push $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG - name: "php 8.0" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG 8.0/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG images/8.0/php - docker images - docker push $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG - stage: "Build child images" name: "phpunit 5.2" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.2-fpm$PR_TAG 5.2/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.2-fpm$PR_TAG images/5.2/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:5.2-fpm$PR_TAG - name: "phpunit 5.3" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.3-fpm$PR_TAG 5.3/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.3-fpm$PR_TAG images/5.3/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:5.3-fpm$PR_TAG - name: "phpunit 5.4" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.4-fpm$PR_TAG 5.4/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.4-fpm$PR_TAG images/5.4/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:5.4-fpm$PR_TAG - name: "phpunit 5.5" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.5-fpm$PR_TAG 5.5/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.5-fpm$PR_TAG images/5.5/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:5.5-fpm$PR_TAG - name: "phpunit 5.6" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.6-fpm$PR_TAG 5.6/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.6-fpm$PR_TAG images/5.6/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:5.6-fpm$PR_TAG - name: "phpunit 7.0" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.0-fpm$PR_TAG 7.0/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.0-fpm$PR_TAG images/7.0/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:7.0-fpm$PR_TAG - name: "phpunit 7.1" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.1-fpm$PR_TAG 7.1/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.1-fpm$PR_TAG images/7.1/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:7.1-fpm$PR_TAG - name: "phpunit 7.2" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.2-fpm$PR_TAG 7.2/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.2-fpm$PR_TAG images/7.2/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:7.2-fpm$PR_TAG - name: "phpunit 7.3" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/phpunit:latest$PR_TAG 7.3/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/phpunit:latest$PR_TAG images/7.3/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:7.3-fpm$PR_TAG - docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG - name: "phpunit 7.4" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.4-fpm$PR_TAG 7.4/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.4-fpm$PR_TAG images/7.4/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:7.4-fpm$PR_TAG - name: "phpunit 8.0" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:8.0-fpm$PR_TAG 8.0/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:8.0-fpm$PR_TAG images/8.0/phpunit - docker images - docker push $PACKAGE_REGISTRY/phpunit:8.0-fpm$PR_TAG - name: "cli 5.2" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.2-fpm$PR_TAG 5.2/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.2-fpm$PR_TAG images/5.2/cli - docker images - docker push $PACKAGE_REGISTRY/cli:5.2-fpm$PR_TAG - name: "cli 5.3" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.3-fpm$PR_TAG 5.3/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.3-fpm$PR_TAG images/5.3/cli - docker images - docker push $PACKAGE_REGISTRY/cli:5.3-fpm$PR_TAG - name: "cli 5.4" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.4-fpm$PR_TAG 5.4/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.4-fpm$PR_TAG images/5.4/cli - docker images - docker push $PACKAGE_REGISTRY/cli:5.4-fpm$PR_TAG - name: "cli 5.5" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.5-fpm$PR_TAG 5.5/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.5-fpm$PR_TAG images/5.5/cli - docker images - docker push $PACKAGE_REGISTRY/cli:5.5-fpm$PR_TAG - name: "cli 5.6" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.6-fpm$PR_TAG 5.6/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.6-fpm$PR_TAG images/5.6/cli - docker images - docker push $PACKAGE_REGISTRY/cli:5.6-fpm$PR_TAG - name: "cli 7.0" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.0-fpm$PR_TAG 7.0/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.0-fpm$PR_TAG images/7.0/cli - docker images - docker push $PACKAGE_REGISTRY/cli:7.0-fpm$PR_TAG - name: "cli 7.1" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.1-fpm$PR_TAG 7.1/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.1-fpm$PR_TAG images/7.1/cli - docker images - docker push $PACKAGE_REGISTRY/cli:7.1-fpm$PR_TAG - name: "cli 7.2" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.2-fpm$PR_TAG 7.2/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.2-fpm$PR_TAG images/7.2/cli - docker images - docker push $PACKAGE_REGISTRY/cli:7.2-fpm$PR_TAG - name: "cli 7.3" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/cli:latest$PR_TAG 7.3/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/cli:latest$PR_TAG images/7.3/cli - docker images - docker push $PACKAGE_REGISTRY/cli:7.3-fpm$PR_TAG - docker push $PACKAGE_REGISTRY/cli:latest$PR_TAG - name: "cli 7.4" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.4-fpm$PR_TAG 7.4/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.4-fpm$PR_TAG images/7.4/cli - docker images - docker push $PACKAGE_REGISTRY/cli:7.4-fpm$PR_TAG - name: "cli 8.0" script: - - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:8.0-fpm$PR_TAG 8.0/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:8.0-fpm$PR_TAG images/8.0/cli - docker images - docker push $PACKAGE_REGISTRY/cli:8.0-fpm$PR_TAG diff --git a/5.2/php/Dockerfile b/5.2/php/Dockerfile deleted file mode 100644 index d770ab4d..00000000 --- a/5.2/php/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM devilbox/php-fpm-5.2:latest - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends sudo; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/5.3/php/Dockerfile b/5.3/php/Dockerfile deleted file mode 100644 index 118ab9d1..00000000 --- a/5.3/php/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM devilbox/php-fpm-5.3:latest - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends unzip sudo; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/5.4/php/Dockerfile b/5.4/php/Dockerfile deleted file mode 100644 index ff1cf07e..00000000 --- a/5.4/php/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:5.4-fpm - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libicu-dev libonig-dev locales sudo; \ - sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ - locale-gen; \ - \ - docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ - \ - docker-php-ext-install gd mysql mysqli zip exif intl mbstring; \ - \ - pecl install xdebug-2.4.1; \ - pecl install memcached-2.2.0; \ - pecl install imagick-3.4.4; \ - docker-php-ext-enable imagick; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/5.5/php/Dockerfile b/5.5/php/Dockerfile deleted file mode 100644 index 2aa69c36..00000000 --- a/5.5/php/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:5.5-fpm - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libicu-dev libonig-dev locales sudo; \ - sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ - locale-gen; \ - \ - docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ - \ - docker-php-ext-install gd mysql mysqli zip exif intl mbstring; \ - \ - pecl install xdebug-2.5.5; \ - pecl install memcached-2.2.0; \ - pecl install imagick-3.4.4; \ - docker-php-ext-enable imagick; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/5.6/php/Dockerfile b/5.6/php/Dockerfile deleted file mode 100644 index 02268a09..00000000 --- a/5.6/php/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:5.6-fpm - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ - sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ - locale-gen; \ - \ - docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ - \ - docker-php-ext-install gd mysql mysqli zip exif intl mbstring; \ - \ - pecl install xdebug-2.5.5; \ - pecl install memcached-2.2.0; \ - pecl install imagick-3.4.4; \ - docker-php-ext-enable imagick; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/7.0/php/Dockerfile b/7.0/php/Dockerfile deleted file mode 100644 index 40367a62..00000000 --- a/7.0/php/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:7.0-fpm - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ - sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ - locale-gen; \ - \ - docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ - \ - docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ - \ - pecl install xdebug-2.7.2; \ - pecl install memcached-3.1.3; \ - pecl install imagick; \ - docker-php-ext-enable imagick; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/7.1/php/Dockerfile b/7.1/php/Dockerfile deleted file mode 100644 index 92871add..00000000 --- a/7.1/php/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:7.1-fpm - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ - sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ - locale-gen; \ - \ - docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ - \ - docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ - \ - pecl install xdebug-2.7.2; \ - pecl install memcached-3.1.3; \ - pecl install imagick; \ - docker-php-ext-enable imagick; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/7.2/php/Dockerfile b/7.2/php/Dockerfile deleted file mode 100644 index a66ada10..00000000 --- a/7.2/php/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:7.2-fpm - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ - sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ - locale-gen; \ - \ - docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ - \ - docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ - \ - pecl install xdebug-2.7.2; \ - pecl install memcached-3.1.3; \ - pecl install imagick; \ - docker-php-ext-enable imagick; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/7.3/php/Dockerfile b/7.3/php/Dockerfile deleted file mode 100644 index 7ac1e96b..00000000 --- a/7.3/php/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:7.3-fpm - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ - sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ - locale-gen; \ - \ - docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ - \ - docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ - \ - pecl install xdebug-2.7.2; \ - pecl install memcached-3.1.3; \ - pecl install imagick; \ - docker-php-ext-enable imagick; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/7.4/php/Dockerfile b/7.4/php/Dockerfile deleted file mode 100644 index b74b68ad..00000000 --- a/7.4/php/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:7.4-rc-fpm - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ - sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ - locale-gen; \ - \ - docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ - \ - docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ - \ - pecl install xdebug-2.8.0beta1; \ - pecl install memcached-3.1.3; \ - pecl install imagick; \ - docker-php-ext-enable imagick; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/8.0/php/Dockerfile b/8.0/php/Dockerfile deleted file mode 100644 index 60670ca0..00000000 --- a/8.0/php/Dockerfile +++ /dev/null @@ -1,47 +0,0 @@ -FROM devilbox/php-fpm-8.0:latest - -WORKDIR /var/www - -########################################################################## -# -# WARNING: This file was generated by update.php. Do not edit it directly. -# -# - -ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_HOME /tmp - -# install the PHP extensions we need -RUN set -ex; \ - \ - apt-get update; \ - \ - apt-get install -y --no-install-recommends unzip sudo; \ - \ - docker-php-ext-install mysqli; \ - \ - curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ - curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ - php -r " \ - \$signature = file_get_contents( '/tmp/installer.sig' ); \ - \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ - if ( \$signature !== \$hash ) { \ - unlink( '/tmp/installer.php' ); \ - unlink( '/tmp/installer.sig' ); \ - echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ - exit( 1 ); \ - }"; \ - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ - composer --ansi --version --no-interaction; \ - rm -f /tmp/installer.php /tmp/installer.sig; - -COPY entrypoint.sh /entrypoint.sh -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf - -RUN chmod +x /entrypoint.sh && \ - groupadd -g 1000 -r wp_php && \ - useradd -u 1000 -s /bin/bash -g wp_php wp_php - -ENTRYPOINT [ "/entrypoint.sh" ] - -CMD [ "php-fpm" ] diff --git a/php-fpm-php.conf b/config/php-fpm-php.conf similarity index 100% rename from php-fpm-php.conf rename to config/php-fpm-php.conf diff --git a/entrypoint-cli.sh b/entrypoint/entrypoint-cli.sh similarity index 100% rename from entrypoint-cli.sh rename to entrypoint/entrypoint-cli.sh diff --git a/entrypoint-php.sh b/entrypoint/entrypoint-php.sh similarity index 100% rename from entrypoint-php.sh rename to entrypoint/entrypoint-php.sh diff --git a/entrypoint-phpunit.sh b/entrypoint/entrypoint-phpunit.sh similarity index 100% rename from entrypoint-phpunit.sh rename to entrypoint/entrypoint-phpunit.sh diff --git a/5.2/cli/Dockerfile b/images/5.2/cli/Dockerfile similarity index 71% rename from 5.2/cli/Dockerfile rename to images/5.2/cli/Dockerfile index ce36fa40..ef088a6b 100644 --- a/5.2/cli/Dockerfile +++ b/images/5.2/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/5.2/cli/entrypoint.sh b/images/5.2/cli/entrypoint.sh similarity index 100% rename from 5.2/cli/entrypoint.sh rename to images/5.2/cli/entrypoint.sh diff --git a/images/5.2/php/Dockerfile b/images/5.2/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/5.2/php/entrypoint.sh b/images/5.2/php/entrypoint.sh similarity index 100% rename from 5.2/php/entrypoint.sh rename to images/5.2/php/entrypoint.sh diff --git a/5.2/php/php-fpm.conf b/images/5.2/php/php-fpm.conf similarity index 100% rename from 5.2/php/php-fpm.conf rename to images/5.2/php/php-fpm.conf diff --git a/5.2/phpunit/Dockerfile b/images/5.2/phpunit/Dockerfile similarity index 78% rename from 5.2/phpunit/Dockerfile rename to images/5.2/phpunit/Dockerfile index 3f7a3ae1..8016508a 100644 --- a/5.2/phpunit/Dockerfile +++ b/images/5.2/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-3.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/5.2/phpunit/entrypoint.sh b/images/5.2/phpunit/entrypoint.sh similarity index 100% rename from 5.2/phpunit/entrypoint.sh rename to images/5.2/phpunit/entrypoint.sh diff --git a/5.3/cli/Dockerfile b/images/5.3/cli/Dockerfile similarity index 84% rename from 5.3/cli/Dockerfile rename to images/5.3/cli/Dockerfile index 746e5a5b..4c36441a 100644 --- a/5.3/cli/Dockerfile +++ b/images/5.3/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/5.3/cli/entrypoint.sh b/images/5.3/cli/entrypoint.sh similarity index 100% rename from 5.3/cli/entrypoint.sh rename to images/5.3/cli/entrypoint.sh diff --git a/images/5.3/php/Dockerfile b/images/5.3/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/5.3/php/entrypoint.sh b/images/5.3/php/entrypoint.sh similarity index 100% rename from 5.3/php/entrypoint.sh rename to images/5.3/php/entrypoint.sh diff --git a/5.3/php/php-fpm.conf b/images/5.3/php/php-fpm.conf similarity index 100% rename from 5.3/php/php-fpm.conf rename to images/5.3/php/php-fpm.conf diff --git a/5.3/phpunit/Dockerfile b/images/5.3/phpunit/Dockerfile similarity index 78% rename from 5.3/phpunit/Dockerfile rename to images/5.3/phpunit/Dockerfile index 06b80286..01a5c440 100644 --- a/5.3/phpunit/Dockerfile +++ b/images/5.3/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/5.3/phpunit/entrypoint.sh b/images/5.3/phpunit/entrypoint.sh similarity index 100% rename from 5.3/phpunit/entrypoint.sh rename to images/5.3/phpunit/entrypoint.sh diff --git a/5.4/cli/Dockerfile b/images/5.4/cli/Dockerfile similarity index 84% rename from 5.4/cli/Dockerfile rename to images/5.4/cli/Dockerfile index 068b8a50..3172791f 100644 --- a/5.4/cli/Dockerfile +++ b/images/5.4/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/5.4/cli/entrypoint.sh b/images/5.4/cli/entrypoint.sh similarity index 100% rename from 5.4/cli/entrypoint.sh rename to images/5.4/cli/entrypoint.sh diff --git a/images/5.4/php/Dockerfile b/images/5.4/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/5.4/php/entrypoint.sh b/images/5.4/php/entrypoint.sh similarity index 100% rename from 5.4/php/entrypoint.sh rename to images/5.4/php/entrypoint.sh diff --git a/5.4/php/php-fpm.conf b/images/5.4/php/php-fpm.conf similarity index 100% rename from 5.4/php/php-fpm.conf rename to images/5.4/php/php-fpm.conf diff --git a/5.4/phpunit/Dockerfile b/images/5.4/phpunit/Dockerfile similarity index 78% rename from 5.4/phpunit/Dockerfile rename to images/5.4/phpunit/Dockerfile index 25f11a80..d4eb96c2 100644 --- a/5.4/phpunit/Dockerfile +++ b/images/5.4/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/5.4/phpunit/entrypoint.sh b/images/5.4/phpunit/entrypoint.sh similarity index 100% rename from 5.4/phpunit/entrypoint.sh rename to images/5.4/phpunit/entrypoint.sh diff --git a/5.5/cli/Dockerfile b/images/5.5/cli/Dockerfile similarity index 84% rename from 5.5/cli/Dockerfile rename to images/5.5/cli/Dockerfile index 9faa1aba..727cd20f 100644 --- a/5.5/cli/Dockerfile +++ b/images/5.5/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/5.5/cli/entrypoint.sh b/images/5.5/cli/entrypoint.sh similarity index 100% rename from 5.5/cli/entrypoint.sh rename to images/5.5/cli/entrypoint.sh diff --git a/images/5.5/php/Dockerfile b/images/5.5/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/5.5/php/entrypoint.sh b/images/5.5/php/entrypoint.sh similarity index 100% rename from 5.5/php/entrypoint.sh rename to images/5.5/php/entrypoint.sh diff --git a/5.5/php/php-fpm.conf b/images/5.5/php/php-fpm.conf similarity index 100% rename from 5.5/php/php-fpm.conf rename to images/5.5/php/php-fpm.conf diff --git a/5.5/phpunit/Dockerfile b/images/5.5/phpunit/Dockerfile similarity index 78% rename from 5.5/phpunit/Dockerfile rename to images/5.5/phpunit/Dockerfile index d846f29b..78ff1fd4 100644 --- a/5.5/phpunit/Dockerfile +++ b/images/5.5/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/5.5/phpunit/entrypoint.sh b/images/5.5/phpunit/entrypoint.sh similarity index 100% rename from 5.5/phpunit/entrypoint.sh rename to images/5.5/phpunit/entrypoint.sh diff --git a/5.6/cli/Dockerfile b/images/5.6/cli/Dockerfile similarity index 84% rename from 5.6/cli/Dockerfile rename to images/5.6/cli/Dockerfile index 595f19b3..e7ce762d 100644 --- a/5.6/cli/Dockerfile +++ b/images/5.6/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/5.6/cli/entrypoint.sh b/images/5.6/cli/entrypoint.sh similarity index 100% rename from 5.6/cli/entrypoint.sh rename to images/5.6/cli/entrypoint.sh diff --git a/images/5.6/php/Dockerfile b/images/5.6/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/5.6/php/entrypoint.sh b/images/5.6/php/entrypoint.sh similarity index 100% rename from 5.6/php/entrypoint.sh rename to images/5.6/php/entrypoint.sh diff --git a/5.6/php/php-fpm.conf b/images/5.6/php/php-fpm.conf similarity index 100% rename from 5.6/php/php-fpm.conf rename to images/5.6/php/php-fpm.conf diff --git a/5.6/phpunit/Dockerfile b/images/5.6/phpunit/Dockerfile similarity index 78% rename from 5.6/phpunit/Dockerfile rename to images/5.6/phpunit/Dockerfile index 292a2341..b1117d08 100644 --- a/5.6/phpunit/Dockerfile +++ b/images/5.6/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-5.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/5.6/phpunit/entrypoint.sh b/images/5.6/phpunit/entrypoint.sh similarity index 100% rename from 5.6/phpunit/entrypoint.sh rename to images/5.6/phpunit/entrypoint.sh diff --git a/7.0/cli/Dockerfile b/images/7.0/cli/Dockerfile similarity index 84% rename from 7.0/cli/Dockerfile rename to images/7.0/cli/Dockerfile index 48147c39..258ec2fc 100644 --- a/7.0/cli/Dockerfile +++ b/images/7.0/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/7.0/cli/entrypoint.sh b/images/7.0/cli/entrypoint.sh similarity index 100% rename from 7.0/cli/entrypoint.sh rename to images/7.0/cli/entrypoint.sh diff --git a/images/7.0/php/Dockerfile b/images/7.0/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/7.0/php/entrypoint.sh b/images/7.0/php/entrypoint.sh similarity index 100% rename from 7.0/php/entrypoint.sh rename to images/7.0/php/entrypoint.sh diff --git a/7.0/php/php-fpm.conf b/images/7.0/php/php-fpm.conf similarity index 100% rename from 7.0/php/php-fpm.conf rename to images/7.0/php/php-fpm.conf diff --git a/7.0/phpunit/Dockerfile b/images/7.0/phpunit/Dockerfile similarity index 78% rename from 7.0/phpunit/Dockerfile rename to images/7.0/phpunit/Dockerfile index c1d4abfc..92d8ccb3 100644 --- a/7.0/phpunit/Dockerfile +++ b/images/7.0/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-6.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/7.0/phpunit/entrypoint.sh b/images/7.0/phpunit/entrypoint.sh similarity index 100% rename from 7.0/phpunit/entrypoint.sh rename to images/7.0/phpunit/entrypoint.sh diff --git a/7.1/cli/Dockerfile b/images/7.1/cli/Dockerfile similarity index 84% rename from 7.1/cli/Dockerfile rename to images/7.1/cli/Dockerfile index 31097bbd..ee76afc7 100644 --- a/7.1/cli/Dockerfile +++ b/images/7.1/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/7.1/cli/entrypoint.sh b/images/7.1/cli/entrypoint.sh similarity index 100% rename from 7.1/cli/entrypoint.sh rename to images/7.1/cli/entrypoint.sh diff --git a/images/7.1/php/Dockerfile b/images/7.1/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/7.1/php/entrypoint.sh b/images/7.1/php/entrypoint.sh similarity index 100% rename from 7.1/php/entrypoint.sh rename to images/7.1/php/entrypoint.sh diff --git a/7.1/php/php-fpm.conf b/images/7.1/php/php-fpm.conf similarity index 100% rename from 7.1/php/php-fpm.conf rename to images/7.1/php/php-fpm.conf diff --git a/7.1/phpunit/Dockerfile b/images/7.1/phpunit/Dockerfile similarity index 78% rename from 7.1/phpunit/Dockerfile rename to images/7.1/phpunit/Dockerfile index b70b8f0a..7831b6a2 100644 --- a/7.1/phpunit/Dockerfile +++ b/images/7.1/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/7.1/phpunit/entrypoint.sh b/images/7.1/phpunit/entrypoint.sh similarity index 100% rename from 7.1/phpunit/entrypoint.sh rename to images/7.1/phpunit/entrypoint.sh diff --git a/7.2/cli/Dockerfile b/images/7.2/cli/Dockerfile similarity index 84% rename from 7.2/cli/Dockerfile rename to images/7.2/cli/Dockerfile index 55c93e45..14203c0f 100644 --- a/7.2/cli/Dockerfile +++ b/images/7.2/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/7.2/cli/entrypoint.sh b/images/7.2/cli/entrypoint.sh similarity index 100% rename from 7.2/cli/entrypoint.sh rename to images/7.2/cli/entrypoint.sh diff --git a/images/7.2/php/Dockerfile b/images/7.2/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/7.2/php/entrypoint.sh b/images/7.2/php/entrypoint.sh similarity index 100% rename from 7.2/php/entrypoint.sh rename to images/7.2/php/entrypoint.sh diff --git a/7.2/php/php-fpm.conf b/images/7.2/php/php-fpm.conf similarity index 100% rename from 7.2/php/php-fpm.conf rename to images/7.2/php/php-fpm.conf diff --git a/7.2/phpunit/Dockerfile b/images/7.2/phpunit/Dockerfile similarity index 78% rename from 7.2/phpunit/Dockerfile rename to images/7.2/phpunit/Dockerfile index 19a5a73b..4acd2d84 100644 --- a/7.2/phpunit/Dockerfile +++ b/images/7.2/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/7.2/phpunit/entrypoint.sh b/images/7.2/phpunit/entrypoint.sh similarity index 100% rename from 7.2/phpunit/entrypoint.sh rename to images/7.2/phpunit/entrypoint.sh diff --git a/7.3/cli/Dockerfile b/images/7.3/cli/Dockerfile similarity index 84% rename from 7.3/cli/Dockerfile rename to images/7.3/cli/Dockerfile index 00cd03d3..798c6818 100644 --- a/7.3/cli/Dockerfile +++ b/images/7.3/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/7.3/cli/entrypoint.sh b/images/7.3/cli/entrypoint.sh similarity index 100% rename from 7.3/cli/entrypoint.sh rename to images/7.3/cli/entrypoint.sh diff --git a/images/7.3/php/Dockerfile b/images/7.3/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/7.3/php/entrypoint.sh b/images/7.3/php/entrypoint.sh similarity index 100% rename from 7.3/php/entrypoint.sh rename to images/7.3/php/entrypoint.sh diff --git a/7.3/php/php-fpm.conf b/images/7.3/php/php-fpm.conf similarity index 100% rename from 7.3/php/php-fpm.conf rename to images/7.3/php/php-fpm.conf diff --git a/7.3/phpunit/Dockerfile b/images/7.3/phpunit/Dockerfile similarity index 78% rename from 7.3/phpunit/Dockerfile rename to images/7.3/phpunit/Dockerfile index 5c992b29..8eea3b0f 100644 --- a/7.3/phpunit/Dockerfile +++ b/images/7.3/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/7.3/phpunit/entrypoint.sh b/images/7.3/phpunit/entrypoint.sh similarity index 100% rename from 7.3/phpunit/entrypoint.sh rename to images/7.3/phpunit/entrypoint.sh diff --git a/7.4/cli/Dockerfile b/images/7.4/cli/Dockerfile similarity index 84% rename from 7.4/cli/Dockerfile rename to images/7.4/cli/Dockerfile index a462d5e7..19304206 100644 --- a/7.4/cli/Dockerfile +++ b/images/7.4/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/7.4/cli/entrypoint.sh b/images/7.4/cli/entrypoint.sh similarity index 100% rename from 7.4/cli/entrypoint.sh rename to images/7.4/cli/entrypoint.sh diff --git a/images/7.4/php/Dockerfile b/images/7.4/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/7.4/php/entrypoint.sh b/images/7.4/php/entrypoint.sh similarity index 100% rename from 7.4/php/entrypoint.sh rename to images/7.4/php/entrypoint.sh diff --git a/7.4/php/php-fpm.conf b/images/7.4/php/php-fpm.conf similarity index 100% rename from 7.4/php/php-fpm.conf rename to images/7.4/php/php-fpm.conf diff --git a/7.4/phpunit/Dockerfile b/images/7.4/phpunit/Dockerfile similarity index 78% rename from 7.4/phpunit/Dockerfile rename to images/7.4/phpunit/Dockerfile index 1ffe0b1e..a988c591 100644 --- a/7.4/phpunit/Dockerfile +++ b/images/7.4/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/7.4/phpunit/entrypoint.sh b/images/7.4/phpunit/entrypoint.sh similarity index 100% rename from 7.4/phpunit/entrypoint.sh rename to images/7.4/phpunit/entrypoint.sh diff --git a/8.0/cli/Dockerfile b/images/8.0/cli/Dockerfile similarity index 84% rename from 8.0/cli/Dockerfile rename to images/8.0/cli/Dockerfile index 8f4aa519..7e02b699 100644 --- a/8.0/cli/Dockerfile +++ b/images/8.0/cli/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # diff --git a/8.0/cli/entrypoint.sh b/images/8.0/cli/entrypoint.sh similarity index 100% rename from 8.0/cli/entrypoint.sh rename to images/8.0/cli/entrypoint.sh diff --git a/images/8.0/php/Dockerfile b/images/8.0/php/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/8.0/php/entrypoint.sh b/images/8.0/php/entrypoint.sh similarity index 100% rename from 8.0/php/entrypoint.sh rename to images/8.0/php/entrypoint.sh diff --git a/8.0/php/php-fpm.conf b/images/8.0/php/php-fpm.conf similarity index 100% rename from 8.0/php/php-fpm.conf rename to images/8.0/php/php-fpm.conf diff --git a/8.0/phpunit/Dockerfile b/images/8.0/phpunit/Dockerfile similarity index 78% rename from 8.0/phpunit/Dockerfile rename to images/8.0/phpunit/Dockerfile index fe606a84..7409fe72 100644 --- a/8.0/phpunit/Dockerfile +++ b/images/8.0/phpunit/Dockerfile @@ -4,8 +4,9 @@ FROM $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG ########################################################################## # -# WARNING: This file was generated by update.php. Do not edit it directly. +# WARNING: This file was generated by update.php. # +# You can find the relevant template in the `/templates` folder. # RUN curl -sL https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit diff --git a/8.0/phpunit/entrypoint.sh b/images/8.0/phpunit/entrypoint.sh similarity index 100% rename from 8.0/phpunit/entrypoint.sh rename to images/8.0/phpunit/entrypoint.sh diff --git a/.travis.yml-template b/templates/.travis.yml-template similarity index 100% rename from .travis.yml-template rename to templates/.travis.yml-template diff --git a/Dockerfile-cli.template b/templates/Dockerfile-cli.template similarity index 100% rename from Dockerfile-cli.template rename to templates/Dockerfile-cli.template diff --git a/Dockerfile-php.template b/templates/Dockerfile-php.template similarity index 100% rename from Dockerfile-php.template rename to templates/Dockerfile-php.template diff --git a/Dockerfile-phpunit.template b/templates/Dockerfile-phpunit.template similarity index 100% rename from Dockerfile-phpunit.template rename to templates/Dockerfile-phpunit.template diff --git a/update.php b/update.php index af034f88..d8148eed 100644 --- a/update.php +++ b/update.php @@ -180,16 +180,17 @@ $generated_warning = << file_get_contents( 'Dockerfile-php.template' ), - 'phpunit' => file_get_contents( 'Dockerfile-phpunit.template' ), - 'cli' => file_get_contents( 'Dockerfile-cli.template' ), + 'php' => file_get_contents( 'templates/ockerfile-php.template' ), + 'phpunit' => file_get_contents( 'templates/Dockerfile-phpunit.template' ), + 'cli' => file_get_contents( 'templates/Dockerfile-cli.template' ), ); $build_cmds = array( @@ -207,7 +208,7 @@ foreach ( $images as $image => $config ) { echo str_pad( $image, 10, '.' ); - echo shell_exec( "mkdir -p $version/$image" ); + echo shell_exec( "mkdir -p images/$version/$image" ); $dockerfile = $templates[ $image ]; @@ -307,18 +308,18 @@ $dockerfile = preg_replace( '/%%[^%]+%%/', '', $dockerfile ); // Write the real Dockerfile. - $fh = fopen( "$version/$image/Dockerfile", 'w' ); + $fh = fopen( "images/$version/$image/Dockerfile", 'w' ); fwrite( $fh, $dockerfile ); fclose( $fh ); // Copy the entrypoint script, if it exists. - if ( file_exists( "entrypoint-$image.sh" ) ) { - copy( "entrypoint-$image.sh", "$version/$image/entrypoint.sh" ); + if ( file_exists( "entrypoint/entrypoint-$image.sh" ) ) { + copy( "entrypoint/entrypoint-$image.sh", "images/$version/$image/entrypoint.sh" ); } // Copy the PHP-FPM configuration, if it exists. - if ( file_exists( "php-fpm-$image.conf" ) ) { - copy( "php-fpm-$image.conf", "$version/$image/php-fpm.conf" ); + if ( file_exists( "config/php-fpm-$image.conf" ) ) { + copy( "config/php-fpm-$image.conf", "images/$version/$image/php-fpm.conf" ); } // Generate the build and push commands for this image/version. @@ -329,7 +330,7 @@ } $build_cmd_list = array( "$image $version", - "$build_cmd $version/$image", + "$build_cmd images/$version/$image", 'docker images', "docker push \$PACKAGE_REGISTRY/$image:$version-fpm\$PR_TAG", ); @@ -343,7 +344,7 @@ } // Load the .travis.yml template. - $travis_template = file_get_contents( '.travis.yml-template' ); + $travis_template = file_get_contents( 'templates/.travis.yml-template' ); $travis_template = str_replace( '%%GENERATED_WARNING%%', $generated_warning, $travis_template ); // Generate the YML-formatted list of build commands for each of the images. From 13e3a2d15580bd30b9bf9cf7f98c2de329485d31 Mon Sep 17 00:00:00 2001 From: Gary Date: Thu, 26 Sep 2019 11:13:00 +1000 Subject: [PATCH 13/16] Move the common entrypoint code to a common file. --- entrypoint/common.sh | 22 ++++++++++++ entrypoint/entrypoint-cli.sh | 20 +---------- entrypoint/entrypoint-php.sh | 20 +---------- entrypoint/entrypoint-phpunit.sh | 20 +---------- images/5.2/cli/entrypoint.sh | 20 +---------- images/5.2/php/Dockerfile | 33 +++++++++++++++++ images/5.2/php/common.sh | 22 ++++++++++++ images/5.2/php/entrypoint.sh | 20 +---------- images/5.2/phpunit/entrypoint.sh | 20 +---------- images/5.3/cli/entrypoint.sh | 20 +---------- images/5.3/php/Dockerfile | 48 +++++++++++++++++++++++++ images/5.3/php/common.sh | 22 ++++++++++++ images/5.3/php/entrypoint.sh | 20 +---------- images/5.3/phpunit/entrypoint.sh | 20 +---------- images/5.4/cli/entrypoint.sh | 20 +---------- images/5.4/php/Dockerfile | 59 +++++++++++++++++++++++++++++++ images/5.4/php/common.sh | 22 ++++++++++++ images/5.4/php/entrypoint.sh | 20 +---------- images/5.4/phpunit/entrypoint.sh | 20 +---------- images/5.5/cli/entrypoint.sh | 20 +---------- images/5.5/php/Dockerfile | 59 +++++++++++++++++++++++++++++++ images/5.5/php/common.sh | 22 ++++++++++++ images/5.5/php/entrypoint.sh | 20 +---------- images/5.5/phpunit/entrypoint.sh | 20 +---------- images/5.6/cli/entrypoint.sh | 20 +---------- images/5.6/php/Dockerfile | 59 +++++++++++++++++++++++++++++++ images/5.6/php/common.sh | 22 ++++++++++++ images/5.6/php/entrypoint.sh | 20 +---------- images/5.6/phpunit/entrypoint.sh | 20 +---------- images/7.0/cli/entrypoint.sh | 20 +---------- images/7.0/php/Dockerfile | 59 +++++++++++++++++++++++++++++++ images/7.0/php/common.sh | 22 ++++++++++++ images/7.0/php/entrypoint.sh | 20 +---------- images/7.0/phpunit/entrypoint.sh | 20 +---------- images/7.1/cli/entrypoint.sh | 20 +---------- images/7.1/php/Dockerfile | 59 +++++++++++++++++++++++++++++++ images/7.1/php/common.sh | 22 ++++++++++++ images/7.1/php/entrypoint.sh | 20 +---------- images/7.1/phpunit/entrypoint.sh | 20 +---------- images/7.2/cli/entrypoint.sh | 20 +---------- images/7.2/php/Dockerfile | 59 +++++++++++++++++++++++++++++++ images/7.2/php/common.sh | 22 ++++++++++++ images/7.2/php/entrypoint.sh | 20 +---------- images/7.2/phpunit/entrypoint.sh | 20 +---------- images/7.3/cli/entrypoint.sh | 20 +---------- images/7.3/php/Dockerfile | 59 +++++++++++++++++++++++++++++++ images/7.3/php/common.sh | 22 ++++++++++++ images/7.3/php/entrypoint.sh | 20 +---------- images/7.3/phpunit/entrypoint.sh | 20 +---------- images/7.4/cli/entrypoint.sh | 20 +---------- images/7.4/php/Dockerfile | 59 +++++++++++++++++++++++++++++++ images/7.4/php/common.sh | 22 ++++++++++++ images/7.4/php/entrypoint.sh | 20 +---------- images/7.4/phpunit/entrypoint.sh | 20 +---------- images/8.0/cli/entrypoint.sh | 20 +---------- images/8.0/php/Dockerfile | 50 ++++++++++++++++++++++++++ images/8.0/php/common.sh | 22 ++++++++++++ images/8.0/php/entrypoint.sh | 20 +---------- images/8.0/phpunit/entrypoint.sh | 20 +---------- templates/Dockerfile-php.template | 2 ++ update.php | 5 +-- 61 files changed, 908 insertions(+), 686 deletions(-) create mode 100644 entrypoint/common.sh create mode 100644 images/5.2/php/common.sh create mode 100644 images/5.3/php/common.sh create mode 100644 images/5.4/php/common.sh create mode 100644 images/5.5/php/common.sh create mode 100644 images/5.6/php/common.sh create mode 100644 images/7.0/php/common.sh create mode 100644 images/7.1/php/common.sh create mode 100644 images/7.2/php/common.sh create mode 100644 images/7.3/php/common.sh create mode 100644 images/7.4/php/common.sh create mode 100644 images/8.0/php/common.sh diff --git a/entrypoint/common.sh b/entrypoint/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/entrypoint/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/entrypoint/entrypoint-cli.sh b/entrypoint/entrypoint-cli.sh index e78162a1..e4fac52d 100644 --- a/entrypoint/entrypoint-cli.sh +++ b/entrypoint/entrypoint-cli.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/entrypoint/entrypoint-php.sh b/entrypoint/entrypoint-php.sh index 79d4e274..c3c3b23c 100644 --- a/entrypoint/entrypoint-php.sh +++ b/entrypoint/entrypoint-php.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/entrypoint/entrypoint-phpunit.sh b/entrypoint/entrypoint-phpunit.sh index 750cd2e4..19aa23ab 100644 --- a/entrypoint/entrypoint-phpunit.sh +++ b/entrypoint/entrypoint-phpunit.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.2/cli/entrypoint.sh b/images/5.2/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/5.2/cli/entrypoint.sh +++ b/images/5.2/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/5.2/php/Dockerfile b/images/5.2/php/Dockerfile index e69de29b..f7048bbd 100644 --- a/images/5.2/php/Dockerfile +++ b/images/5.2/php/Dockerfile @@ -0,0 +1,33 @@ +FROM devilbox/php-fpm-5.2:latest + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends sudo; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/5.2/php/common.sh b/images/5.2/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/5.2/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/5.2/php/entrypoint.sh b/images/5.2/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/5.2/php/entrypoint.sh +++ b/images/5.2/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/5.2/phpunit/entrypoint.sh b/images/5.2/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/5.2/phpunit/entrypoint.sh +++ b/images/5.2/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.3/cli/entrypoint.sh b/images/5.3/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/5.3/cli/entrypoint.sh +++ b/images/5.3/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/5.3/php/Dockerfile b/images/5.3/php/Dockerfile index e69de29b..d4b17873 100644 --- a/images/5.3/php/Dockerfile +++ b/images/5.3/php/Dockerfile @@ -0,0 +1,48 @@ +FROM devilbox/php-fpm-5.3:latest + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends unzip sudo; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/5.3/php/common.sh b/images/5.3/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/5.3/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/5.3/php/entrypoint.sh b/images/5.3/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/5.3/php/entrypoint.sh +++ b/images/5.3/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/5.3/phpunit/entrypoint.sh b/images/5.3/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/5.3/phpunit/entrypoint.sh +++ b/images/5.3/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.4/cli/entrypoint.sh b/images/5.4/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/5.4/cli/entrypoint.sh +++ b/images/5.4/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/5.4/php/Dockerfile b/images/5.4/php/Dockerfile index e69de29b..3c90925f 100644 --- a/images/5.4/php/Dockerfile +++ b/images/5.4/php/Dockerfile @@ -0,0 +1,59 @@ +FROM php:5.4-fpm + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libicu-dev libonig-dev locales sudo; \ + sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ + locale-gen; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + \ + docker-php-ext-install gd mysql mysqli zip exif intl mbstring; \ + \ + pecl install xdebug-2.4.1; \ + pecl install memcached-2.2.0; \ + pecl install imagick-3.4.4; \ + docker-php-ext-enable imagick; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/5.4/php/common.sh b/images/5.4/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/5.4/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/5.4/php/entrypoint.sh b/images/5.4/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/5.4/php/entrypoint.sh +++ b/images/5.4/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/5.4/phpunit/entrypoint.sh b/images/5.4/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/5.4/phpunit/entrypoint.sh +++ b/images/5.4/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.5/cli/entrypoint.sh b/images/5.5/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/5.5/cli/entrypoint.sh +++ b/images/5.5/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/5.5/php/Dockerfile b/images/5.5/php/Dockerfile index e69de29b..1aa01779 100644 --- a/images/5.5/php/Dockerfile +++ b/images/5.5/php/Dockerfile @@ -0,0 +1,59 @@ +FROM php:5.5-fpm + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libicu-dev libonig-dev locales sudo; \ + sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ + locale-gen; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + \ + docker-php-ext-install gd mysql mysqli zip exif intl mbstring; \ + \ + pecl install xdebug-2.5.5; \ + pecl install memcached-2.2.0; \ + pecl install imagick-3.4.4; \ + docker-php-ext-enable imagick; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/5.5/php/common.sh b/images/5.5/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/5.5/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/5.5/php/entrypoint.sh b/images/5.5/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/5.5/php/entrypoint.sh +++ b/images/5.5/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/5.5/phpunit/entrypoint.sh b/images/5.5/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/5.5/phpunit/entrypoint.sh +++ b/images/5.5/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.6/cli/entrypoint.sh b/images/5.6/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/5.6/cli/entrypoint.sh +++ b/images/5.6/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/5.6/php/Dockerfile b/images/5.6/php/Dockerfile index e69de29b..6af5c318 100644 --- a/images/5.6/php/Dockerfile +++ b/images/5.6/php/Dockerfile @@ -0,0 +1,59 @@ +FROM php:5.6-fpm + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ + sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ + locale-gen; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + \ + docker-php-ext-install gd mysql mysqli zip exif intl mbstring; \ + \ + pecl install xdebug-2.5.5; \ + pecl install memcached-2.2.0; \ + pecl install imagick-3.4.4; \ + docker-php-ext-enable imagick; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/5.6/php/common.sh b/images/5.6/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/5.6/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/5.6/php/entrypoint.sh b/images/5.6/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/5.6/php/entrypoint.sh +++ b/images/5.6/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/5.6/phpunit/entrypoint.sh b/images/5.6/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/5.6/phpunit/entrypoint.sh +++ b/images/5.6/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.0/cli/entrypoint.sh b/images/7.0/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/7.0/cli/entrypoint.sh +++ b/images/7.0/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/7.0/php/Dockerfile b/images/7.0/php/Dockerfile index e69de29b..50f1262b 100644 --- a/images/7.0/php/Dockerfile +++ b/images/7.0/php/Dockerfile @@ -0,0 +1,59 @@ +FROM php:7.0-fpm + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ + sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ + locale-gen; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + \ + docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ + \ + pecl install xdebug-2.7.2; \ + pecl install memcached-3.1.3; \ + pecl install imagick; \ + docker-php-ext-enable imagick; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/7.0/php/common.sh b/images/7.0/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/7.0/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/7.0/php/entrypoint.sh b/images/7.0/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/7.0/php/entrypoint.sh +++ b/images/7.0/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/7.0/phpunit/entrypoint.sh b/images/7.0/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/7.0/phpunit/entrypoint.sh +++ b/images/7.0/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.1/cli/entrypoint.sh b/images/7.1/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/7.1/cli/entrypoint.sh +++ b/images/7.1/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/7.1/php/Dockerfile b/images/7.1/php/Dockerfile index e69de29b..a4ead5ad 100644 --- a/images/7.1/php/Dockerfile +++ b/images/7.1/php/Dockerfile @@ -0,0 +1,59 @@ +FROM php:7.1-fpm + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ + sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ + locale-gen; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + \ + docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ + \ + pecl install xdebug-2.7.2; \ + pecl install memcached-3.1.3; \ + pecl install imagick; \ + docker-php-ext-enable imagick; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/7.1/php/common.sh b/images/7.1/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/7.1/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/7.1/php/entrypoint.sh b/images/7.1/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/7.1/php/entrypoint.sh +++ b/images/7.1/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/7.1/phpunit/entrypoint.sh b/images/7.1/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/7.1/phpunit/entrypoint.sh +++ b/images/7.1/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.2/cli/entrypoint.sh b/images/7.2/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/7.2/cli/entrypoint.sh +++ b/images/7.2/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/7.2/php/Dockerfile b/images/7.2/php/Dockerfile index e69de29b..2fed70a3 100644 --- a/images/7.2/php/Dockerfile +++ b/images/7.2/php/Dockerfile @@ -0,0 +1,59 @@ +FROM php:7.2-fpm + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ + sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ + locale-gen; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + \ + docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ + \ + pecl install xdebug-2.7.2; \ + pecl install memcached-3.1.3; \ + pecl install imagick; \ + docker-php-ext-enable imagick; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/7.2/php/common.sh b/images/7.2/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/7.2/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/7.2/php/entrypoint.sh b/images/7.2/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/7.2/php/entrypoint.sh +++ b/images/7.2/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/7.2/phpunit/entrypoint.sh b/images/7.2/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/7.2/phpunit/entrypoint.sh +++ b/images/7.2/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.3/cli/entrypoint.sh b/images/7.3/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/7.3/cli/entrypoint.sh +++ b/images/7.3/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/7.3/php/Dockerfile b/images/7.3/php/Dockerfile index e69de29b..bcea1b03 100644 --- a/images/7.3/php/Dockerfile +++ b/images/7.3/php/Dockerfile @@ -0,0 +1,59 @@ +FROM php:7.3-fpm + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ + sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ + locale-gen; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + \ + docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ + \ + pecl install xdebug-2.7.2; \ + pecl install memcached-3.1.3; \ + pecl install imagick; \ + docker-php-ext-enable imagick; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/7.3/php/common.sh b/images/7.3/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/7.3/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/7.3/php/entrypoint.sh b/images/7.3/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/7.3/php/entrypoint.sh +++ b/images/7.3/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/7.3/phpunit/entrypoint.sh b/images/7.3/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/7.3/phpunit/entrypoint.sh +++ b/images/7.3/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.4/cli/entrypoint.sh b/images/7.4/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/7.4/cli/entrypoint.sh +++ b/images/7.4/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/7.4/php/Dockerfile b/images/7.4/php/Dockerfile index e69de29b..d8417b4d 100644 --- a/images/7.4/php/Dockerfile +++ b/images/7.4/php/Dockerfile @@ -0,0 +1,59 @@ +FROM php:7.4-rc-fpm + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo; \ + sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \ + locale-gen; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + \ + docker-php-ext-install gd opcache mysqli zip exif intl mbstring; \ + \ + pecl install xdebug-2.8.0beta1; \ + pecl install memcached-3.1.3; \ + pecl install imagick; \ + docker-php-ext-enable imagick; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/7.4/php/common.sh b/images/7.4/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/7.4/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/7.4/php/entrypoint.sh b/images/7.4/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/7.4/php/entrypoint.sh +++ b/images/7.4/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/7.4/phpunit/entrypoint.sh b/images/7.4/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/7.4/phpunit/entrypoint.sh +++ b/images/7.4/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/images/8.0/cli/entrypoint.sh b/images/8.0/cli/entrypoint.sh index e78162a1..e4fac52d 100644 --- a/images/8.0/cli/entrypoint.sh +++ b/images/8.0/cli/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then diff --git a/images/8.0/php/Dockerfile b/images/8.0/php/Dockerfile index e69de29b..887a89e4 100644 --- a/images/8.0/php/Dockerfile +++ b/images/8.0/php/Dockerfile @@ -0,0 +1,50 @@ +FROM devilbox/php-fpm-8.0:latest + +WORKDIR /var/www + +########################################################################## +# +# WARNING: This file was generated by update.php. +# +# You can find the relevant template in the `/templates` folder. +# + +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp + +# install the PHP extensions we need +RUN set -ex; \ + \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends unzip sudo; \ + \ + docker-php-ext-install mysqli; \ + \ + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \ + curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \ + php -r " \ + \$signature = file_get_contents( '/tmp/installer.sig' ); \ + \$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \ + if ( \$signature !== \$hash ) { \ + unlink( '/tmp/installer.php' ); \ + unlink( '/tmp/installer.sig' ); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit( 1 ); \ + }"; \ + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \ + composer --ansi --version --no-interaction; \ + rm -f /tmp/installer.php /tmp/installer.sig; + +COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh +COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf + +RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ + groupadd -g 1000 -r wp_php && \ + useradd -u 1000 -s /bin/bash -g wp_php wp_php + +ENTRYPOINT [ "/entrypoint.sh" ] + +CMD [ "php-fpm" ] diff --git a/images/8.0/php/common.sh b/images/8.0/php/common.sh new file mode 100644 index 00000000..7f257d1e --- /dev/null +++ b/images/8.0/php/common.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled +if [ "$LOCAL_PHP_XDEBUG" = true ]; then + docker-php-ext-enable xdebug + rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +else + docker-php-ext-enable opcache + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi + +# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled +if [ "$LOCAL_PHP_MEMCACHED" = true ]; then + docker-php-ext-enable memcached +else + rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini +fi + +### Change UID/GID +usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" +groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" diff --git a/images/8.0/php/entrypoint.sh b/images/8.0/php/entrypoint.sh index 79d4e274..c3c3b23c 100755 --- a/images/8.0/php/entrypoint.sh +++ b/images/8.0/php/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD exec "$@" diff --git a/images/8.0/phpunit/entrypoint.sh b/images/8.0/phpunit/entrypoint.sh index 750cd2e4..19aa23ab 100644 --- a/images/8.0/phpunit/entrypoint.sh +++ b/images/8.0/phpunit/entrypoint.sh @@ -1,25 +1,7 @@ #!/bin/bash set -e -# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled -if [ "$LOCAL_PHP_XDEBUG" = true ]; then - docker-php-ext-enable xdebug - rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -else - docker-php-ext-enable opcache - rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -fi - -# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled -if [ "$LOCAL_PHP_MEMCACHED" = true ]; then - docker-php-ext-enable memcached -else - rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini -fi - -### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +source /common.sh # Execute CMD sudo -u wp_php "$@" diff --git a/templates/Dockerfile-php.template b/templates/Dockerfile-php.template index ff939fdf..0c0e158f 100644 --- a/templates/Dockerfile-php.template +++ b/templates/Dockerfile-php.template @@ -10,9 +10,11 @@ ENV COMPOSER_HOME /tmp %%INSTALL_EXTENSIONS%% COPY entrypoint.sh /entrypoint.sh +COPY common.sh /common.sh COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf RUN chmod +x /entrypoint.sh && \ + chmod +x /common.sh && \ groupadd -g 1000 -r wp_php && \ useradd -u 1000 -s /bin/bash -g wp_php wp_php diff --git a/update.php b/update.php index d8148eed..50f51944 100644 --- a/update.php +++ b/update.php @@ -188,7 +188,7 @@ // Load the templates. $templates = array( - 'php' => file_get_contents( 'templates/ockerfile-php.template' ), + 'php' => file_get_contents( 'templates/Dockerfile-php.template' ), 'phpunit' => file_get_contents( 'templates/Dockerfile-phpunit.template' ), 'cli' => file_get_contents( 'templates/Dockerfile-cli.template' ), ); @@ -286,9 +286,10 @@ } $dockerfile = str_replace( '%%INSTALL_EXTENSIONS%%', $install_extensions, $dockerfile ); - } + copy( "entrypoint/common.sh", "images/$version/$image/common.sh" ); + } elseif ( $image === 'phpunit' ) { // Replace tags inside the PHPUnit Dockerfile template. $dockerfile = str_replace( '%%PHPUNIT_VERSION%%', $config, $dockerfile ); From 2efb33b9b9635f19544180920247f54f1c306ddf Mon Sep 17 00:00:00 2001 From: Gary Date: Thu, 26 Sep 2019 11:25:19 +1000 Subject: [PATCH 14/16] Don't try to change the UID/GID if it's already set correctly. Prevents a noisy message from usermod/groupmod that nothing changed. --- entrypoint/common.sh | 12 ++++++++++-- images/5.2/php/common.sh | 12 ++++++++++-- images/5.3/php/common.sh | 12 ++++++++++-- images/5.4/php/common.sh | 12 ++++++++++-- images/5.5/php/common.sh | 12 ++++++++++-- images/5.6/php/common.sh | 12 ++++++++++-- images/7.0/php/common.sh | 12 ++++++++++-- images/7.1/php/common.sh | 12 ++++++++++-- images/7.2/php/common.sh | 12 ++++++++++-- images/7.3/php/common.sh | 12 ++++++++++-- images/7.4/php/common.sh | 12 ++++++++++-- images/8.0/php/common.sh | 12 ++++++++++-- 12 files changed, 120 insertions(+), 24 deletions(-) diff --git a/entrypoint/common.sh b/entrypoint/common.sh index 7f257d1e..b0df5979 100644 --- a/entrypoint/common.sh +++ b/entrypoint/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/5.2/php/common.sh b/images/5.2/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/5.2/php/common.sh +++ b/images/5.2/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/5.3/php/common.sh b/images/5.3/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/5.3/php/common.sh +++ b/images/5.3/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/5.4/php/common.sh b/images/5.4/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/5.4/php/common.sh +++ b/images/5.4/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/5.5/php/common.sh b/images/5.5/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/5.5/php/common.sh +++ b/images/5.5/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/5.6/php/common.sh b/images/5.6/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/5.6/php/common.sh +++ b/images/5.6/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/7.0/php/common.sh b/images/7.0/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/7.0/php/common.sh +++ b/images/7.0/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/7.1/php/common.sh b/images/7.1/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/7.1/php/common.sh +++ b/images/7.1/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/7.2/php/common.sh b/images/7.2/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/7.2/php/common.sh +++ b/images/7.2/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/7.3/php/common.sh b/images/7.3/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/7.3/php/common.sh +++ b/images/7.3/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/7.4/php/common.sh b/images/7.4/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/7.4/php/common.sh +++ b/images/7.4/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi diff --git a/images/8.0/php/common.sh b/images/8.0/php/common.sh index 7f257d1e..b0df5979 100644 --- a/images/8.0/php/common.sh +++ b/images/8.0/php/common.sh @@ -18,5 +18,13 @@ else fi ### Change UID/GID -usermod -o -u "${PHP_FPM_UID-1000}" "wp_php" -groupmod -o -g "${PHP_FPM_GID-1000}" "wp_php" +WP_PHP_UID="${PHP_FPM_UID-1000}" +WP_PHP_GID="${PHP_FPM_GID-1000}" + +if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then + usermod -o -u "${WP_PHP_UID}" "wp_php" +fi + +if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then + groupmod -o -g "${WP_PHP_GID}" "wp_php" +fi From e250ca5c70b219f393aa9270d3c7a11cde65ffb4 Mon Sep 17 00:00:00 2001 From: Gary Date: Thu, 26 Sep 2019 13:12:56 +1000 Subject: [PATCH 15/16] Ensure the PHPUnit upload volume is owned by the correct user. --- entrypoint/entrypoint-phpunit.sh | 2 ++ images/5.2/phpunit/entrypoint.sh | 2 ++ images/5.3/phpunit/entrypoint.sh | 2 ++ images/5.4/phpunit/entrypoint.sh | 2 ++ images/5.5/phpunit/entrypoint.sh | 2 ++ images/5.6/phpunit/entrypoint.sh | 2 ++ images/7.0/phpunit/entrypoint.sh | 2 ++ images/7.1/phpunit/entrypoint.sh | 2 ++ images/7.2/phpunit/entrypoint.sh | 2 ++ images/7.3/phpunit/entrypoint.sh | 2 ++ images/7.4/phpunit/entrypoint.sh | 2 ++ images/8.0/phpunit/entrypoint.sh | 2 ++ 12 files changed, 24 insertions(+) diff --git a/entrypoint/entrypoint-phpunit.sh b/entrypoint/entrypoint-phpunit.sh index 19aa23ab..5785da15 100644 --- a/entrypoint/entrypoint-phpunit.sh +++ b/entrypoint/entrypoint-phpunit.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.2/phpunit/entrypoint.sh b/images/5.2/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/5.2/phpunit/entrypoint.sh +++ b/images/5.2/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.3/phpunit/entrypoint.sh b/images/5.3/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/5.3/phpunit/entrypoint.sh +++ b/images/5.3/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.4/phpunit/entrypoint.sh b/images/5.4/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/5.4/phpunit/entrypoint.sh +++ b/images/5.4/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.5/phpunit/entrypoint.sh b/images/5.5/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/5.5/phpunit/entrypoint.sh +++ b/images/5.5/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.6/phpunit/entrypoint.sh b/images/5.6/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/5.6/phpunit/entrypoint.sh +++ b/images/5.6/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.0/phpunit/entrypoint.sh b/images/7.0/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/7.0/phpunit/entrypoint.sh +++ b/images/7.0/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.1/phpunit/entrypoint.sh b/images/7.1/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/7.1/phpunit/entrypoint.sh +++ b/images/7.1/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.2/phpunit/entrypoint.sh b/images/7.2/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/7.2/phpunit/entrypoint.sh +++ b/images/7.2/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.3/phpunit/entrypoint.sh b/images/7.3/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/7.3/phpunit/entrypoint.sh +++ b/images/7.3/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.4/phpunit/entrypoint.sh b/images/7.4/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/7.4/phpunit/entrypoint.sh +++ b/images/7.4/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" diff --git a/images/8.0/phpunit/entrypoint.sh b/images/8.0/phpunit/entrypoint.sh index 19aa23ab..5785da15 100644 --- a/images/8.0/phpunit/entrypoint.sh +++ b/images/8.0/phpunit/entrypoint.sh @@ -3,5 +3,7 @@ set -e source /common.sh +chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php + # Execute CMD sudo -u wp_php "$@" From 315ab2b6f533595f579819e896eb3fcb414ebe86 Mon Sep 17 00:00:00 2001 From: Gary Date: Thu, 26 Sep 2019 13:27:11 +1000 Subject: [PATCH 16/16] That is now how chown works. --- entrypoint/entrypoint-phpunit.sh | 2 +- images/5.2/phpunit/entrypoint.sh | 2 +- images/5.3/phpunit/entrypoint.sh | 2 +- images/5.4/phpunit/entrypoint.sh | 2 +- images/5.5/phpunit/entrypoint.sh | 2 +- images/5.6/phpunit/entrypoint.sh | 2 +- images/7.0/phpunit/entrypoint.sh | 2 +- images/7.1/phpunit/entrypoint.sh | 2 +- images/7.2/phpunit/entrypoint.sh | 2 +- images/7.3/phpunit/entrypoint.sh | 2 +- images/7.4/phpunit/entrypoint.sh | 2 +- images/8.0/phpunit/entrypoint.sh | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/entrypoint/entrypoint-phpunit.sh b/entrypoint/entrypoint-phpunit.sh index 5785da15..cfe29e05 100644 --- a/entrypoint/entrypoint-phpunit.sh +++ b/entrypoint/entrypoint-phpunit.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.2/phpunit/entrypoint.sh b/images/5.2/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/5.2/phpunit/entrypoint.sh +++ b/images/5.2/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.3/phpunit/entrypoint.sh b/images/5.3/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/5.3/phpunit/entrypoint.sh +++ b/images/5.3/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.4/phpunit/entrypoint.sh b/images/5.4/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/5.4/phpunit/entrypoint.sh +++ b/images/5.4/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.5/phpunit/entrypoint.sh b/images/5.5/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/5.5/phpunit/entrypoint.sh +++ b/images/5.5/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/5.6/phpunit/entrypoint.sh b/images/5.6/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/5.6/phpunit/entrypoint.sh +++ b/images/5.6/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.0/phpunit/entrypoint.sh b/images/7.0/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/7.0/phpunit/entrypoint.sh +++ b/images/7.0/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.1/phpunit/entrypoint.sh b/images/7.1/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/7.1/phpunit/entrypoint.sh +++ b/images/7.1/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.2/phpunit/entrypoint.sh b/images/7.2/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/7.2/phpunit/entrypoint.sh +++ b/images/7.2/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.3/phpunit/entrypoint.sh b/images/7.3/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/7.3/phpunit/entrypoint.sh +++ b/images/7.3/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/7.4/phpunit/entrypoint.sh b/images/7.4/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/7.4/phpunit/entrypoint.sh +++ b/images/7.4/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@" diff --git a/images/8.0/phpunit/entrypoint.sh b/images/8.0/phpunit/entrypoint.sh index 5785da15..cfe29e05 100644 --- a/images/8.0/phpunit/entrypoint.sh +++ b/images/8.0/phpunit/entrypoint.sh @@ -3,7 +3,7 @@ set -e source /common.sh -chown -R /var/www/${LOCAL_DIR-src}/wp-content/uploads wp_php:wp_php +chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads # Execute CMD sudo -u wp_php "$@"