2021-09-22 18:53:18 +02:00
|
|
|
ARG PHP_VERSION=7.4
|
2021-09-01 21:03:25 +02:00
|
|
|
ARG WP_VERSION=5.8.0
|
2020-03-29 01:42:21 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# WP CLI
|
|
|
|
FROM --platform=${TARGETPLATFORM} wordpress:cli-php${PHP_VERSION} AS wp-cli
|
2020-03-29 01:42:21 +01:00
|
|
|
|
2021-09-25 00:47:50 +02:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Build rootfs
|
|
|
|
FROM scratch AS rootfs
|
2021-09-25 00:47:50 +02:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Install wp-cli
|
|
|
|
COPY --from=wp-cli ["/usr/local/bin/wp", "/usr/local/bin/wp-cli"]
|
2020-03-29 01:42:21 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Install attr utility
|
|
|
|
COPY --from=nlss/attr ["/usr/local/bin/attr", "/usr/local/bin/"]
|
2020-03-29 01:42:21 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Add crond service
|
|
|
|
COPY --from=nlss/base-alpine:3.14 ["/etc/services.d/cron/", "/etc/services.d/cron/"]
|
2020-03-29 01:42:21 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Add container init tasks
|
|
|
|
COPY --from=nlss/php-nginx:7.4 ["/etc/cont-init.d/", "/etc/cont-init.d/"]
|
|
|
|
|
|
|
|
# Add php-fpm configuration
|
|
|
|
COPY --from=nlss/php-nginx:7.4 ["/usr/local/etc/php-fpm.d/", "/usr/local/etc/php-fpm.d/"]
|
|
|
|
|
|
|
|
# Add php-fpm service
|
|
|
|
COPY --from=nlss/php-nginx:7.4 ["/etc/services.d/php-fpm/", "/etc/services.d/php-fpm/"]
|
|
|
|
|
|
|
|
# Add nginx service and configuration
|
|
|
|
COPY --from=nlss/php-nginx:7.4 ["/etc/services.d/nginx/", "/etc/services.d/nginx/"]
|
|
|
|
COPY --from=nlss/php-nginx:7.4 ["/etc/nginx/", "/etc/nginx/"]
|
|
|
|
COPY --from=nlss/php-nginx:7.4 ["/var/", "/var/"]
|
2021-09-25 01:11:23 +02:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Install gomplate
|
|
|
|
COPY --from=hairyhenderson/gomplate:v3.10.0-alpine ["/bin/gomplate", "/usr/local/bin/"]
|
2021-09-25 01:11:23 +02:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Install s6 supervisor
|
|
|
|
COPY --from=nlss/s6-rootfs:2.2 ["/", "/"]
|
2020-03-29 01:42:21 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Overlay
|
|
|
|
COPY ["./rootfs/", "/"]
|
2021-02-09 20:42:24 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
# Configuration and patches
|
2021-09-25 01:11:23 +02:00
|
|
|
ARG WP_VERSION
|
2022-01-14 23:25:15 +01:00
|
|
|
COPY ["wp-config.php", "/var/www/html/"]
|
|
|
|
COPY ["patches/${WP_VERSION}/wp-admin-update-core.patch", "/etc/wp-mods/"]
|
|
|
|
|
|
|
|
|
|
|
|
# Stage 3 - Final
|
|
|
|
FROM --platform=${TARGETPLATFORM} wordpress:${WP_VERSION}-php${PHP_VERSION}-fpm-alpine
|
|
|
|
|
|
|
|
RUN apk add --update --no-cache patch less mysql-client nginx tzdata
|
2020-03-29 01:42:21 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
COPY --from=rootfs ["/", "/"]
|
2021-09-25 01:11:23 +02:00
|
|
|
RUN echo "*/5 * * * * /usr/local/bin/wp cron event run --due-now" >> /etc/crontabs/www-data \
|
2020-06-17 02:45:25 +02:00
|
|
|
&& chmod a+x /usr/local/bin/wp
|
2020-03-29 01:42:21 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
ARG WP_VERSION
|
|
|
|
ENV WP_VERSION ${WP_VERSION}
|
|
|
|
ENV WP_LOCALE en_US
|
|
|
|
ENV VIRTUAL_HOST your-domain.com
|
|
|
|
ENV S6_KEEP_ENV 1
|
|
|
|
#ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
|
|
|
ENV ENFORCE_DISABLE_WP_UPDATES true
|
2021-02-09 20:42:24 +01:00
|
|
|
ENV WP_CLI_DISABLE_AUTO_CHECK_UPDATE true
|
2022-01-14 23:25:15 +01:00
|
|
|
ENV CRON_ENABLED true
|
|
|
|
ENV WEB_ROOT html
|
2021-02-09 20:42:24 +01:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
WORKDIR "/var/www/${WEB_ROOT}/"
|
|
|
|
VOLUME ["/root/.wp-cli", "/var/www/${WEB_ROOT}", "/var/www/${WEB_ROOT}/wp-content"]
|
2020-06-16 19:41:09 +02:00
|
|
|
|
2022-01-14 23:25:15 +01:00
|
|
|
ENTRYPOINT ["/init"]
|
2021-01-11 20:31:23 +01:00
|
|
|
EXPOSE 80/TCP
|