Skip to content

Instantly share code, notes, and snippets.

@naviarh
Last active February 17, 2022 20:38
Show Gist options
  • Save naviarh/59d2831fbdf01797198d29b91781061c to your computer and use it in GitHub Desktop.
Save naviarh/59d2831fbdf01797198d29b91781061c to your computer and use it in GitHub Desktop.
FROM alpine:3.15
MAINTAINER Navi Arkh
LABEL description "Lightweight WordPress with Nginx & PHP-FPM based on Alpine Linux."
ARG WORDPRESS_VERSION=5.9
ARG WORDPRESS_SHA1=4e9a256f5cbcfba26108a1a9ebdb31f2ab29af9f
RUN echo "@main http://dl-cdn.alpinelinux.org/alpine/edge/main/" >> /etc/apk/main \
&& echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories \
&& echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories \
&& apk upgrade --update-cache --available \
&& apk add --force \
bash@main \
nginx@main \
php8@community \
php8-fpm@community \
php8-mysqli@community \
php8-common@community \
php8-openssl@community \
php8-curl@community \
php8-xml@community \
php8-phar@community \
php8-intl@community \
php8-dom@community \
php8-xmlreader@community \
php8-ctype@community \
php8-mbstring@community \
php8-gd@community \
supervisor@main \
&& rm -rf /tmp/* /var/cache/apk/* /var/cache/distfiles/*
RUN mkdir -p /usr/src \
&& wget "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz" -O /tmp/wordpress.tar.gz \
&& echo "$WORDPRESS_SHA1 */tmp/wordpress.tar.gz" | sha1sum -c - \
&& tar -xzf /tmp/wordpress.tar.gz -C /usr/src/ \
&& rm /tmp/wordpress.tar.gz
COPY dockerfiles/wp-config.php /usr/src/wordpress/wp-config.php
COPY dockerfiles/wp-secrets.php /usr/src/wordpress/wp-secrets.php
RUN chown -R nobody.nogroup /usr/src/wordpress \
&& chmod 640 /usr/src/wordpress/wp-config.php \
&& chmod 640 /usr/src/wordpress/wp-secrets.php
COPY dockerfiles/nginx.conf /etc/nginx/nginx.conf
COPY dockerfiles/zzz_custom.conf /etc/php8/php-fpm.d/zzz_custom.conf
COPY dockerfiles/zzz_custom.ini /etc/php8/conf.d/zzz_custom.ini
COPY dockerfiles/supervisord.conf /etc/supervisord.conf
EXPOSE 80
RUN chown -R nobody.nogroup /var/www
# WORKDIR /var/www/wp-content
# VOLUME /var/www/wp-content
ADD dockerfiles/docker-entrypoint.sh /
ENTRYPOINT ["/sbin/tini", "--", "/docker-entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment