wp/Dockerfile
changeset 39 5a716b5cfe09
parent 4 f0b7075b9496
--- a/wp/Dockerfile	Mon Dec 02 13:34:27 2019 +0100
+++ b/wp/Dockerfile	Fri Mar 05 02:12:27 2021 +0100
@@ -1,65 +1,72 @@
-FROM php:7.3-fpm-alpine
+FROM php:7.3-fpm
 
 # docker-entrypoint.sh dependencies
-RUN apk add --no-cache \
-# in theory, docker-entrypoint.sh is POSIX-compliant, but priority is a working, consistent image
-		bash \
-# BusyBox sed is not sufficient for some of our sed expressions
-		sed \
+RUN apt-get update && apt-get install -y \
 		less \
-		mysql-client ; \
-	apk add --no-cache --virtual .composer-rundeps git subversion openssh mercurial tini patch make zip unzip coreutils;
+		default-mysql-client \
+		git \
+		subversion \
+		openssh-client \
+		mercurial \
+		tini \
+		patch \
+		make \
+		zip \
+		unzip \
+		coreutils\
+ && rm -rf /var/lib/apt/lists/*
 
 
-RUN set -ex; \
+RUN set -ex \
 	\
 	# install the PHP extensions we need
-	apk add --no-cache --virtual .build-deps \
-		libjpeg-turbo-dev \
-		libpng-dev \
-		libzip-dev \
-		zlib-dev; \
-	docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
-	docker-php-ext-configure zip --with-libzip; \
-	docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd mysqli opcache zip; \
-	runDeps="$( \
-		scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
-			| tr ',' '\n' \
-			| sort -u \
-			| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
-	)"; \
-	apk add --virtual .wordpress-phpexts-rundeps $runDeps; \
-# install composer dependencies
-	apk add --no-cache --virtual .composer-phpext-rundeps $runDeps; \
-	printf "# composer php cli ini settings\n\
+ && buildDeps='libjpeg-dev libpng-dev libzip-dev zlib1g-dev pax-utils libicu-dev' \
+ && apt-get update && apt-get install -y $buildDeps --no-install-recommends \
+ && rm -rf /var/lib/apt/lists/* \
+ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
+ && docker-php-ext-configure zip --with-libzip \
+ && docker-php-ext-configure intl \
+ && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd mysqli opcache zip intl \
+ && runDeps="libjpeg62-turbo libpng16-16 libzip4 libicu63" \
+ && apt-get install -y $runDeps --no-install-recommends \
+ && printf "# composer php cli ini settings\n\
 date.timezone=UTC\n\
 memory_limit=-1\n\
 opcache.enable_cli=1\n\
-" > $PHP_INI_DIR/php-cli.ini ; \
+" > $PHP_INI_DIR/php-cli.ini \
 # clean
-	apk del .build-deps
+ && apt-get purge -y --auto-remove $buildDeps
+
 
-# install composer
+#  && runDeps="$( \
+# 		scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
+# 			| tr ',' '\n' \
+# 			| sort -u \
+# 			| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print $1 }' \
+# 			| xargs -n1 dpkg -S \
+# 			| cut -d: -f1 \
+# 			| sort -u \
+# 	)" \
+#  && apt-get install -y $runDeps --no-install-recommends \
+
+
+# # install composer
 ENV COMPOSER_ALLOW_SUPERUSER 1
 ENV COMPOSER_HOME /tmp
-ENV COMPOSER_VERSION 1.8.5
+ENV COMPOSER_VERSION 2.0.11
 
-RUN curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://raw.githubusercontent.com/composer/getcomposer.org/cb19f2aa3aeaa2006c0cd69a7ef011eb31463067/web/installer \
- && php -r " \
-    \$signature = '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5'; \
-    \$hash = hash('sha384', file_get_contents('/tmp/installer.php')); \
-    if (!hash_equals(\$signature, \$hash)) { \
-      unlink('/tmp/installer.php'); \
-      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 --version=${COMPOSER_VERSION} \
+RUN EXPECTED_CHECKSUM="$(curl --silent https://composer.github.io/installer.sig)" \
+  && curl --silent --fail --location --retry 3 --output /tmp/composer-setup.php --url https://getcomposer.org/installer \
+  && ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', '/tmp/composer-setup.php');")" \
+ && if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then \
+      >&2 echo 'ERROR: Invalid installer checksum'; \
+      rm /tmp/composer-setup.php; \
+      exit 1; \
+    fi \
+ && php /tmp/composer-setup.php --quiet --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
  && composer --ansi --version --no-interaction \
 # install prestissimo composer parallel install plugin.
- && composer --no-interaction global require --no-progress hirak/prestissimo \
- && rm -f /tmp/installer.php
-
-
+ && rm /tmp/composer-setup.php
 
 # set recommended PHP.ini settings
 # see https://secure.php.net/manual/en/opcache.installation.php