wp/Dockerfile
changeset 39 5a716b5cfe09
parent 4 f0b7075b9496
equal deleted inserted replaced
38:c6ce67c1ec54 39:5a716b5cfe09
     1 FROM php:7.3-fpm-alpine
     1 FROM php:7.3-fpm
     2 
     2 
     3 # docker-entrypoint.sh dependencies
     3 # docker-entrypoint.sh dependencies
     4 RUN apk add --no-cache \
     4 RUN apt-get update && apt-get install -y \
     5 # in theory, docker-entrypoint.sh is POSIX-compliant, but priority is a working, consistent image
       
     6 		bash \
       
     7 # BusyBox sed is not sufficient for some of our sed expressions
       
     8 		sed \
       
     9 		less \
     5 		less \
    10 		mysql-client ; \
     6 		default-mysql-client \
    11 	apk add --no-cache --virtual .composer-rundeps git subversion openssh mercurial tini patch make zip unzip coreutils;
     7 		git \
       
     8 		subversion \
       
     9 		openssh-client \
       
    10 		mercurial \
       
    11 		tini \
       
    12 		patch \
       
    13 		make \
       
    14 		zip \
       
    15 		unzip \
       
    16 		coreutils\
       
    17  && rm -rf /var/lib/apt/lists/*
    12 
    18 
    13 
    19 
    14 RUN set -ex; \
    20 RUN set -ex \
    15 	\
    21 	\
    16 	# install the PHP extensions we need
    22 	# install the PHP extensions we need
    17 	apk add --no-cache --virtual .build-deps \
    23  && buildDeps='libjpeg-dev libpng-dev libzip-dev zlib1g-dev pax-utils libicu-dev' \
    18 		libjpeg-turbo-dev \
    24  && apt-get update && apt-get install -y $buildDeps --no-install-recommends \
    19 		libpng-dev \
    25  && rm -rf /var/lib/apt/lists/* \
    20 		libzip-dev \
    26  && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
    21 		zlib-dev; \
    27  && docker-php-ext-configure zip --with-libzip \
    22 	docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
    28  && docker-php-ext-configure intl \
    23 	docker-php-ext-configure zip --with-libzip; \
    29  && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd mysqli opcache zip intl \
    24 	docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd mysqli opcache zip; \
    30  && runDeps="libjpeg62-turbo libpng16-16 libzip4 libicu63" \
    25 	runDeps="$( \
    31  && apt-get install -y $runDeps --no-install-recommends \
    26 		scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
    32  && printf "# composer php cli ini settings\n\
    27 			| tr ',' '\n' \
       
    28 			| sort -u \
       
    29 			| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
       
    30 	)"; \
       
    31 	apk add --virtual .wordpress-phpexts-rundeps $runDeps; \
       
    32 # install composer dependencies
       
    33 	apk add --no-cache --virtual .composer-phpext-rundeps $runDeps; \
       
    34 	printf "# composer php cli ini settings\n\
       
    35 date.timezone=UTC\n\
    33 date.timezone=UTC\n\
    36 memory_limit=-1\n\
    34 memory_limit=-1\n\
    37 opcache.enable_cli=1\n\
    35 opcache.enable_cli=1\n\
    38 " > $PHP_INI_DIR/php-cli.ini ; \
    36 " > $PHP_INI_DIR/php-cli.ini \
    39 # clean
    37 # clean
    40 	apk del .build-deps
    38  && apt-get purge -y --auto-remove $buildDeps
    41 
    39 
    42 # install composer
    40 
       
    41 #  && runDeps="$( \
       
    42 # 		scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
       
    43 # 			| tr ',' '\n' \
       
    44 # 			| sort -u \
       
    45 # 			| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print $1 }' \
       
    46 # 			| xargs -n1 dpkg -S \
       
    47 # 			| cut -d: -f1 \
       
    48 # 			| sort -u \
       
    49 # 	)" \
       
    50 #  && apt-get install -y $runDeps --no-install-recommends \
       
    51 
       
    52 
       
    53 # # install composer
    43 ENV COMPOSER_ALLOW_SUPERUSER 1
    54 ENV COMPOSER_ALLOW_SUPERUSER 1
    44 ENV COMPOSER_HOME /tmp
    55 ENV COMPOSER_HOME /tmp
    45 ENV COMPOSER_VERSION 1.8.5
    56 ENV COMPOSER_VERSION 2.0.11
    46 
    57 
    47 RUN curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://raw.githubusercontent.com/composer/getcomposer.org/cb19f2aa3aeaa2006c0cd69a7ef011eb31463067/web/installer \
    58 RUN EXPECTED_CHECKSUM="$(curl --silent https://composer.github.io/installer.sig)" \
    48  && php -r " \
    59   && curl --silent --fail --location --retry 3 --output /tmp/composer-setup.php --url https://getcomposer.org/installer \
    49     \$signature = '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5'; \
    60   && ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', '/tmp/composer-setup.php');")" \
    50     \$hash = hash('sha384', file_get_contents('/tmp/installer.php')); \
    61  && if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then \
    51     if (!hash_equals(\$signature, \$hash)) { \
    62       >&2 echo 'ERROR: Invalid installer checksum'; \
    52       unlink('/tmp/installer.php'); \
    63       rm /tmp/composer-setup.php; \
    53       echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
    64       exit 1; \
    54       exit(1); \
    65     fi \
    55     }" \
    66  && php /tmp/composer-setup.php --quiet --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
    56  && php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
       
    57  && composer --ansi --version --no-interaction \
    67  && composer --ansi --version --no-interaction \
    58 # install prestissimo composer parallel install plugin.
    68 # install prestissimo composer parallel install plugin.
    59  && composer --no-interaction global require --no-progress hirak/prestissimo \
    69  && rm /tmp/composer-setup.php
    60  && rm -f /tmp/installer.php
       
    61 
       
    62 
       
    63 
    70 
    64 # set recommended PHP.ini settings
    71 # set recommended PHP.ini settings
    65 # see https://secure.php.net/manual/en/opcache.installation.php
    72 # see https://secure.php.net/manual/en/opcache.installation.php
    66 RUN { \
    73 RUN { \
    67 		echo 'opcache.memory_consumption=128'; \
    74 		echo 'opcache.memory_consumption=128'; \