|
| 1 | +FROM php:%%PHP_VERSION%%-%%VARIANT%% |
| 2 | + |
| 3 | +# our docker-entrypoint.sh is a bit involved |
| 4 | +RUN apk add --no-cache bash |
| 5 | +# in theory, it is POSIX-compliant, but first priority is a working, consistent image |
| 6 | + |
| 7 | +# install the PHP extensions we need |
| 8 | +RUN set -ex; \ |
| 9 | + \ |
| 10 | + apk add --no-cache --virtual .build-deps \ |
| 11 | + libjpeg-turbo-dev \ |
| 12 | + libpng-dev \ |
| 13 | + ; \ |
| 14 | + \ |
| 15 | + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ |
| 16 | + docker-php-ext-install gd mysqli opcache; \ |
| 17 | + \ |
| 18 | + runDeps="$( \ |
| 19 | + scanelf --needed --nobanner --recursive \ |
| 20 | + /usr/local/lib/php/extensions \ |
| 21 | + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ |
| 22 | + | sort -u \ |
| 23 | + | xargs -r apk info --installed \ |
| 24 | + | sort -u \ |
| 25 | + )"; \ |
| 26 | + apk add --virtual .wordpress-phpexts-rundeps $runDeps; \ |
| 27 | + apk del .build-deps |
| 28 | + |
| 29 | +# set recommended PHP.ini settings |
| 30 | +# see https://secure.php.net/manual/en/opcache.installation.php |
| 31 | +RUN { \ |
| 32 | + echo 'opcache.memory_consumption=128'; \ |
| 33 | + echo 'opcache.interned_strings_buffer=8'; \ |
| 34 | + echo 'opcache.max_accelerated_files=4000'; \ |
| 35 | + echo 'opcache.revalidate_freq=2'; \ |
| 36 | + echo 'opcache.fast_shutdown=1'; \ |
| 37 | + echo 'opcache.enable_cli=1'; \ |
| 38 | + } > /usr/local/etc/php/conf.d/opcache-recommended.ini |
| 39 | +%%VARIANT_EXTRAS%% |
| 40 | +VOLUME /var/www/html |
| 41 | + |
| 42 | +ENV WORDPRESS_VERSION %%WORDPRESS_VERSION%% |
| 43 | +ENV WORDPRESS_SHA1 %%WORDPRESS_SHA1%% |
| 44 | + |
| 45 | +RUN set -ex; \ |
| 46 | + curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz"; \ |
| 47 | + echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -; \ |
| 48 | +# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress |
| 49 | + tar -xzf wordpress.tar.gz -C /usr/src/; \ |
| 50 | + rm wordpress.tar.gz; \ |
| 51 | + chown -R www-data:www-data /usr/src/wordpress |
| 52 | + |
| 53 | +COPY docker-entrypoint.sh /usr/local/bin/ |
| 54 | + |
| 55 | +ENTRYPOINT ["docker-entrypoint.sh"] |
| 56 | +CMD ["%%CMD%%"] |
0 commit comments