diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index a3973b7a09306..265c2f7ce2876 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -27,7 +27,7 @@ RUN --mount=type=cache,target=/var/lib/apt/lists/,sharing=private \ && add-apt-repository ppa:ondrej/php \ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ && apt-get update \ - && apt-get install -y \ + && apt-get --purge install -y \ apache2 \ git \ jq \ @@ -38,14 +38,15 @@ RUN --mount=type=cache,target=/var/lib/apt/lists/,sharing=private \ ssmtp \ subversion \ sudo \ + systemd-standalone-tmpfiles \ unzip \ vim \ zip \ && apt-get remove --purge --auto-remove -y gpg software-properties-common \ && find /var/ -name '*-old' -delete && rm -rf /var/log/dpkg.log /var/log/alternatives.log /var/log/apt/ ~/.launchpadlib -# Enable mod_rewrite in Apache. -RUN a2enmod rewrite +# Enable various Apache modules. +RUN a2dismod mpm_prefork && a2enmod rewrite mpm_event proxy_fcgi http2 # Install requested version of PHP. COPY ./config/php.ini /var/lib/jetpack-config/php.ini @@ -53,6 +54,7 @@ RUN --mount=type=cache,target=/var/lib/apt/lists/,sharing=private \ --mount=type=bind,source=./bin/ensure-php-version.sh,target=/usr/local/bin/ensure-php-version.sh \ : "${PHP_VERSION:?Build argument PHP_VERSION needs to be set and non-empty.}" \ && ensure-php-version.sh "$PHP_VERSION" \ + && a2enconf "php$PHP_VERSION-fpm" \ && find /var/ -name '*-old' -delete && rm -rf /var/log/dpkg.log /var/log/alternatives.log /var/log/apt/ ~/.launchpadlib # Install requested version of Composer. diff --git a/tools/docker/bin/ensure-php-version.sh b/tools/docker/bin/ensure-php-version.sh index fa7c384213a52..1019233e52745 100755 --- a/tools/docker/bin/ensure-php-version.sh +++ b/tools/docker/bin/ensure-php-version.sh @@ -20,11 +20,11 @@ export DEBIAN_FRONTEND=noninteractive # Determine packages to install. PKGS=( - "libapache2-mod-php${VER}" "php${VER}" "php${VER}-bcmath" "php${VER}-cli" "php${VER}-curl" + "php${VER}-fpm" "php${VER}-intl" "php${VER}-ldap" "php${VER}-mbstring" diff --git a/tools/docker/bin/run.sh b/tools/docker/bin/run.sh index ad2ae6aa7106e..1d02ce843f06f 100755 --- a/tools/docker/bin/run.sh +++ b/tools/docker/bin/run.sh @@ -7,6 +7,8 @@ set -e # If you modify anything here, remember to build the image again by running: # jetpack docker build-image +source /etc/docker-args.sh + user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" @@ -133,5 +135,7 @@ echo "Open http://${WP_DOMAIN}${WP_HOST_PORT}/ to see your site!" echo # Run apache in the foreground so the container keeps running +echo "Running php-fpm" +"/etc/init.d/php${PHP_VERSION}-fpm" start echo "Running Apache in the foreground" apachectl -D FOREGROUND