wp/Dockerfile
author ymh <ymh.work@gmail.com>
Mon, 08 Mar 2021 16:17:44 +0100
changeset 45 02af213cad7d
parent 39 5a716b5cfe09
permissions -rw-r--r--
Added tag 0.8.1 for changeset 75ec8b6829cc

FROM php:7.3-fpm

# docker-entrypoint.sh dependencies
RUN apt-get update && apt-get install -y \
		less \
		default-mysql-client \
		git \
		subversion \
		openssh-client \
		mercurial \
		tini \
		patch \
		make \
		zip \
		unzip \
		coreutils\
 && rm -rf /var/lib/apt/lists/*


RUN set -ex \
	\
	# install the PHP extensions we need
 && 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 \
# clean
 && apt-get purge -y --auto-remove $buildDeps


#  && 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 2.0.11

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.
 && rm /tmp/composer-setup.php

# 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
# https://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Logging
RUN { \
		echo 'error_reporting = 4339'; \
		echo 'display_errors = Off'; \
		echo 'display_startup_errors = Off'; \
		echo 'log_errors = On'; \
		echo 'error_log = /dev/stderr'; \
		echo 'log_errors_max_len = 1024'; \
		echo 'ignore_repeated_errors = On'; \
		echo 'ignore_repeated_source = Off'; \
		echo 'html_errors = Off'; \
	} > /usr/local/etc/php/conf.d/error-logging.ini

VOLUME /var/www/html

COPY ./docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php-fpm"]