wordpress-dev/production/Dockerfile

50 lines
1.6 KiB
Docker
Raw Normal View History

2020-03-08 15:55:06 +00:00
FROM alpine:3.11
ENV WP_VERSION 5.3
RUN set -x \
&& addgroup -g 82 -S www-data \
&& adduser -u 82 -D -S -G www-data www-data
RUN apk --no-cache add php7 php7-fpm php7-mysqli php7-json php7-openssl php7-curl \
php7-simplexml php7-ctype php7-mbstring php7-gd php7-redis supervisor curl \
php7-zlib php7-xml php7-phar php7-intl php7-dom php7-xmlreader php7-opcache less mariadb-client \
libpng libjpeg-turbo bash \
&& rm -rf /var/www/localhost
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/php7/conf.d/opcache-recommended.ini
RUN mkdir -p /var/www && chown -R www-data:www-data /var/www
WORKDIR /var/www
RUN sed -i s/'user = nobody'/'user = www-data'/g /etc/php7/php-fpm.d/www.conf \
&& sed -i s/'group = nobody'/'group = www-data'/g /etc/php7/php-fpm.d/www.conf \
&& sed -i s/'listen = 127.0.0.1:9000'/'listen = 9000'/g /etc/php7/php-fpm.d/www.conf
VOLUME /var/www/wordpress
COPY config/php.ini /etc/php7/conf.d/zzz_custom_php.ini
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/cron.conf /etc/crontabs/www-data
RUN rm -rf /tmp/* \
&& chmod 600 /etc/crontabs/www-data \
&& curl -sfo /usr/local/bin/wp -L https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x /usr/local/bin/wp
WORKDIR /var/www/wordpress
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
EXPOSE 80
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]