# Build the actual image. FROM php:7.1-apache # install the PHP extensions we need RUN set -ex; \ \ savedAptMark="$(apt-mark showmanual)"; \ \ apt-get update; \ apt-get install -y --no-install-recommends \ libjpeg-dev \ libpng-dev \ nano \ ; \ \ docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ docker-php-ext-install gd mysqli opcache; \ \ # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark; \ ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ | awk '/=>/ { print $3 }' \ | sort -u \ | xargs -r dpkg-query -S \ | cut -d: -f1 \ | sort -u \ | xargs -rt apt-mark manual; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/* # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php RUN { \ echo 'opcache.memory_consumption=128'; \ echo 'opcache.interned_strings_buffer=8'; \ echo 'opcache.max_accelerated_files=4000'; \ echo 'opcache.revalidate_freq=2'; \ echo 'opcache.fast_shutdown=1'; \ echo 'opcache.enable_cli=1'; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini RUN a2enmod rewrite expires VOLUME /var/www/html/wp-content/uploads COPY --chown=www-data:www-data . /var/www/html COPY .docker/docker-entrypoint.sh /usr/local/bin/ COPY .docker/.htaccess /var/www/html/.htaccess COPY .docker/wp-config2.php /var/www/html/wp-config2.php # This timestamp is used to check if the default uploads folder needs to be copied. RUN date +%s > /container-build-time RUN chmod -R 777 /var/www/html ENTRYPOINT [".docker/docker-entrypoint.sh"] CMD ["apache2-foreground"]