All checks were successful
continuous-integration/drone/push Build is passing
94 lines
3.2 KiB
Docker
94 lines
3.2 KiB
Docker
ARG UNIT_VERSION=1.11.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
|
|
|
|
VOLUME /var/www/html
|
|
|
|
ENV WORDPRESS_VERSION 5.2.3
|
|
ENV WORDPRESS_SHA1 5efd37148788f3b14b295b2a9bf48a1a467aa303
|
|
|
|
RUN set -ex; \
|
|
apt-get update && apt-get -y install --no-install-recommends \
|
|
php7.3-mysql \
|
|
&& rm -rf /var/lib/apt/lists/* ; \
|
|
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; \
|
|
chown -R www-data:www-data /var/www/html
|
|
|
|
# port used by the listener in config.json
|
|
EXPOSE 8080
|
|
|
|
# launch and configure Unit
|
|
RUN \
|
|
[ -f /var/www/html/index.php ] || { \
|
|
touch /var/www/html/index.php /var/www/html/index.php.remove; \
|
|
} \
|
|
&& unitd --control unix:/var/run/control.unit.sock \
|
|
&& curl -X PUT --data-binary \
|
|
'{ \
|
|
"listeners": { "*:8080": { "pass": "routes" } }, \
|
|
"routes": [ \
|
|
{ "match": { "uri": "*.php" }, "action": { "pass": "applications/direct_php" } }, \
|
|
{ "match": { "uri": "!*/" }, "action": { "share": "/var/www/html" } }, \
|
|
{ "action": { "pass": "applications/index_php" } } \
|
|
], \
|
|
"applications": { \
|
|
"index_php": { \
|
|
"type": "php", \
|
|
"processes": { "max": 20, "spare": 5 }, \
|
|
"user": "www-data", \
|
|
"group": "www-data", \
|
|
"root": "/var/www/html", \
|
|
"script": "index.php" \
|
|
}, \
|
|
"direct_php": { \
|
|
"type": "php", \
|
|
"processes": { "max": 5, "spare": 0 }, \
|
|
"user": "www-data", \
|
|
"group": "www-data", \
|
|
"root": "/var/www/html", \
|
|
"index": "index.php" \
|
|
} \
|
|
} \
|
|
}' \
|
|
--unix-socket /var/run/control.unit.sock http://localhost/config/ \
|
|
&& [ -f /var/www/html/index.php.remove ] && { \
|
|
rm /var/www/html/index.php /var/www/html/index.php.remove; \
|
|
}
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
COPY docker-entrypoint.sh /usr/local/bin/
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
|
|
STOPSIGNAL SIGTERM
|
|
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
|