ARG UNIT_VERSION=1.10.0 FROM eumau/nginx-unit:${UNIT_VERSION}-php7.3 # 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'; \ } > /etc/php/7.3/embed/conf.d/opcache-recommended.ini # https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging RUN { \ # https://www.php.net/manual/en/errorfunc.constants.php # https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670 echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ 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'; \ } > /etc/php/7.3/embed/conf.d/error-logging.ini ENV WORDPRESS_VERSION 5.2.3 ENV WORDPRESS_SHA1 5efd37148788f3b14b295b2a9bf48a1a467aa303 RUN set -ex; \ curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz"; \ echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -; \ # upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress tar -xzf wordpress.tar.gz -C /usr/src/; \ rm wordpress.tar.gz; \ chown -R www-data:www-data /usr/src/wordpress # port used by the listener in config.json EXPOSE 8080 # application setup RUN mkdir -p /var/www/html && echo ' /var/www/html/index.php && chown -R www-data:www-data /var/www/html VOLUME /var/www/html # launch Unit RUN unitd --control unix:/var/run/control.unit.sock \ # upload the app config to Unit && curl -X PUT --data-binary '{ \ "listeners": { \ "*:8080": { \ "pass": "applications/wordpress" \ } \ }, \ "applications": { \ "wordpress": { \ "type": "php", \ "user": "www-data", \ "group": "www-data", \ "root": "/var/www/html" \ } \ } \ }' --unix-socket /var/run/control.unit.sock http://localhost/config/ VOLUME /www # COPY docker-entrypoint.sh /usr/local/bin/ # ENTRYPOINT ["docker-entrypoint.sh"]