2014-11-07 01:41:50 +01:00
|
|
|
WORKDIR /var/www/html
|
2016-01-22 21:52:42 +01:00
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
&& cd /usr/local/etc \
|
|
|
|
&& if [ -d php-fpm.d ]; then \
|
|
|
|
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
|
|
|
|
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
|
|
|
|
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
|
|
|
|
else \
|
2016-12-01 15:43:54 +01:00
|
|
|
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
|
2016-01-22 21:52:42 +01:00
|
|
|
mkdir php-fpm.d; \
|
|
|
|
cp php-fpm.conf.default php-fpm.d/www.conf; \
|
|
|
|
{ \
|
|
|
|
echo '[global]'; \
|
|
|
|
echo 'include=etc/php-fpm.d/*.conf'; \
|
|
|
|
} | tee php-fpm.conf; \
|
|
|
|
fi \
|
|
|
|
&& { \
|
|
|
|
echo '[global]'; \
|
|
|
|
echo 'error_log = /proc/self/fd/2'; \
|
2019-01-01 00:52:47 +01:00
|
|
|
echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \
|
2018-12-07 08:43:05 +01:00
|
|
|
echo; \
|
2016-01-22 21:52:42 +01:00
|
|
|
echo '[www]'; \
|
|
|
|
echo '; if we send this to /proc/self/fd/1, it never appears'; \
|
|
|
|
echo 'access.log = /proc/self/fd/2'; \
|
|
|
|
echo; \
|
|
|
|
echo 'clear_env = no'; \
|
|
|
|
echo; \
|
|
|
|
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
|
|
|
|
echo 'catch_workers_output = yes'; \
|
2018-10-10 14:30:40 +02:00
|
|
|
echo 'decorate_workers_output = no'; \
|
2016-01-22 21:52:42 +01:00
|
|
|
} | tee php-fpm.d/docker.conf \
|
|
|
|
&& { \
|
|
|
|
echo '[global]'; \
|
|
|
|
echo 'daemonize = no'; \
|
|
|
|
echo; \
|
|
|
|
echo '[www]'; \
|
2018-01-13 20:56:46 +01:00
|
|
|
echo 'listen = 9000'; \
|
2016-01-22 21:52:42 +01:00
|
|
|
} | tee php-fpm.d/zz-docker.conf
|
2014-11-07 01:41:50 +01:00
|
|
|
|
|
|
|
EXPOSE 9000
|
2019-04-18 11:02:12 +02:00
|
|
|
|
|
|
|
# Override stop signal to stop process gracefully
|
|
|
|
#
|
|
|
|
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
|
|
|
|
STOPSIGNAL SIGQUIT
|
|
|
|
|
2014-11-07 01:41:50 +01:00
|
|
|
CMD ["php-fpm"]
|