Move the slowest running statement to the beginig of the stage

[ More efficient caching ]
This commit is contained in:
xZero707 2021-09-25 01:11:23 +02:00
parent 0020bca6c9
commit b9dbb0a6a3

View File

@ -19,21 +19,23 @@ COPY --from=wordpress /usr/local/lib/php/test /usr/local/lib/php/test/
# Stage 3 - Final # Stage 3 - Final
FROM --platform=${TARGETPLATFORM} nlss/php-nginx:${PHP_VERSION} FROM --platform=${TARGETPLATFORM} nlss/php-nginx:${PHP_VERSION}
# As long as new version doesn't require changes to Dockerfile, we don't need separate files # As long as new version doesn't require changes to Dockerfile, we don't need separate files
ARG WP_VERSION
ENV APK_RUNTIME_DEPS "zlib-dev libzip-dev libpng-dev icu-dev imagemagick-dev patch"
ENV APK_WP_CLI_DEPS "bash less mysql-client"
RUN apk add --update --no-cache ${APK_WP_CLI_DEPS} ${APK_RUNTIME_DEPS}
COPY --from=wordpress-rootfs / / COPY --from=wordpress-rootfs / /
COPY --from=wordpress:cli-php7.4 /usr/local/bin/wp /usr/local/bin/wp-cli COPY --from=wordpress:cli-php7.4 /usr/local/bin/wp /usr/local/bin/wp-cli
ENV APK_RUNTIME_DEPS "zlib-dev libzip-dev libpng-dev icu-dev imagemagick-dev patch" ARG WP_VERSION
ENV APK_WP_CLI_DEPS "bash less mysql-client"
ENV WP_VERSION ${WP_VERSION} ENV WP_VERSION ${WP_VERSION}
ENV WP_LOCALE en_US ENV WP_LOCALE en_US
ENV CRON_ENABLED true ENV CRON_ENABLED true
ENV VIRTUAL_HOST your-domain.com ENV VIRTUAL_HOST your-domain.com
ADD rootfs / ADD rootfs /
RUN apk add --update --no-cache ${APK_WP_CLI_DEPS} ${APK_RUNTIME_DEPS} \ RUN echo "*/5 * * * * /usr/local/bin/wp cron event run --due-now" >> /etc/crontabs/www-data \
&& echo "*/5 * * * * /usr/local/bin/wp cron event run --due-now" >> /etc/crontabs/www-data \
&& chmod a+x /usr/local/bin/wp && chmod a+x /usr/local/bin/wp
VOLUME ["/root/.wp-cli", "/var/www/${WEB_ROOT}", "/var/www/${WEB_ROOT}/wp-content"] VOLUME ["/root/.wp-cli", "/var/www/${WEB_ROOT}", "/var/www/${WEB_ROOT}/wp-content"]