Skip to content
Permalink
master
Switch branches/tags
Go to file
5 contributors

Users who have contributed to this file

@TrafeX @nstapelbroek @RickvdStaaij @vic @eXistenZNL
FROM alpine:3.13
LABEL Maintainer="Tim de Pater <code@trafex.nl>" \
Description="Lightweight WordPress container with Nginx 1.18 & PHP-FPM 7.4 based on Alpine Linux."
# Install packages
RUN apk --no-cache add \
php7 \
php7-fpm \
php7-mysqli \
php7-json \
php7-openssl \
php7-curl \
php7-zlib \
php7-xml \
php7-phar \
php7-intl \
php7-dom \
php7-xmlreader \
php7-xmlwriter \
php7-exif \
php7-fileinfo \
php7-sodium \
php7-openssl \
php7-gd \
php7-imagick \
php7-simplexml \
php7-ctype \
php7-mbstring \
php7-zip \
php7-opcache \
nginx \
supervisor \
curl \
bash \
less
# Configure nginx
COPY config/nginx.conf /etc/nginx/nginx.conf
# Configure PHP-FPM
COPY config/fpm-pool.conf /etc/php7/php-fpm.d/zzz_custom.conf
COPY config/php.ini /etc/php7/conf.d/zzz_custom.ini
# Configure supervisord
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# wp-content volume
VOLUME /var/www/wp-content
WORKDIR /var/www/wp-content
RUN chown -R nobody.nobody /var/www
# WordPress
ENV WORDPRESS_VERSION 5.7
ENV WORDPRESS_SHA1 76d1332cfcbc5f8b17151b357999d1f758faf897
RUN mkdir -p /usr/src
# Upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \
&& echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \
&& tar -xzf wordpress.tar.gz -C /usr/src/ \
&& rm wordpress.tar.gz \
&& chown -R nobody.nobody /usr/src/wordpress
# Add WP CLI
RUN curl -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x /usr/local/bin/wp
# WP config
COPY wp-config.php /usr/src/wordpress
RUN chown nobody.nobody /usr/src/wordpress/wp-config.php && chmod 640 /usr/src/wordpress/wp-config.php
# Append WP secrets
COPY wp-secrets.php /usr/src/wordpress
RUN chown nobody.nobody /usr/src/wordpress/wp-secrets.php && chmod 640 /usr/src/wordpress/wp-secrets.php
# Entrypoint to copy wp-content
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1/wp-login.php