Loading Dockerfile +9 −5 Original line number Diff line number Diff line # syntax = docker/dockerfile:1.0-experimental ARG nginx_version=latest FROM nginx:${nginx_version} as nginx ARG nginx_version ARG php_version FROM nginx:${nginx_version:-latest} as nginx LABEL uk.org.kodo.maintainer = "Dom Sekotill <dom.sekotill@kodo.org.uk>" COPY data/nginx /etc/nginx ARG php_version= FROM php:${php_version:+$php_version-}fpm-alpine as deps RUN --mount=type=bind,source=scripts/install-deps.sh,target=/stage /stage FROM deps as compile RUN --mount=type=bind,source=scripts/compile.sh,target=/stage /stage RUN --mount=type=bind,source=scripts/install-build-deps.sh,target=/stage /stage RUN --mount=type=bind,source=scripts/compile-dist-ext.sh,target=/stage /stage RUN --mount=type=bind,source=scripts/compile-imagick.sh,target=/stage /stage FROM deps as fastcgi LABEL uk.org.kodo.maintainer "Dom Sekotill <dom.sekotill@kodo.org.uk>" ARG wp_version=latest WORKDIR /app ENV WORDPRESS_ROOT=/app Loading @@ -25,6 +27,8 @@ COPY --from=compile /usr/local/etc/php /usr/local/etc/php COPY --from=compile /usr/local/lib/php /usr/local/lib/php COPY scripts/wp.sh /usr/local/bin/wp COPY data/composer.json /app/composer.json ARG wp_version=latest RUN --mount=type=bind,source=scripts/install-wp.sh,target=/stage \ /stage ${wp_version} Loading README.md +5 −1 Original line number Diff line number Diff line Loading @@ -54,10 +54,14 @@ Build > **Note:** Building manually requires Docker 18.09 or later with the > [Buildkit][] feature enabled. > **Note:** *(Dec 2020)* Currently WP-CLI does not support PHP-8. Likely various plugins and > themes also do not work with PHP-8. Therefore until wider support is available, supply > a PHP-7 version with a build argument. To build the PHP-FPM image run: ```shell DOCKER_BUILDKIT=1 docker build -t wordpress:tag . DOCKER_BUILDKIT=1 docker build -t wordpress:tag --build-arg php_version=7.4.13 . ``` To build the Nginx companion image, run: Loading scripts/compile.sh→scripts/compile-dist-ext.sh +0 −20 Original line number Diff line number Diff line #!/bin/bash set -eux # Packaged build dependencies BUILD_DEPS=( autoconf build-base gmp-dev imagemagick-dev jpeg-dev libpng-dev libwebp-dev libzip-dev ) # Distributed extensions PHP_EXT=( bcmath Loading @@ -30,10 +18,6 @@ php_version() { return 1 } # Install packaged dependencies apk update apk add "${BUILD_DEPS[@]}" # Build & install distributed extensions if php_version -gt 7.4; then GD_ARGS=( --with-jpeg=/usr --with-webp=/usr ) Loading @@ -42,7 +26,3 @@ else fi docker-php-ext-configure gd "${GD_ARGS[@]}" docker-php-ext-install -j$(nproc) "${PHP_EXT[@]}" # Download, build & install the Image Magick extension pecl install imagick echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini scripts/compile-imagick.sh 0 → 100755 +11 −0 Original line number Diff line number Diff line #!/bin/bash set -eux cd $(mktemp -d) git clone --depth 1 https://github.com/imagick/imagick.git . phpize ./configure make install echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini scripts/install-build-deps.sh 0 → 100755 +15 −0 Original line number Diff line number Diff line #!/bin/sh set -eux # Install packaged dependencies apk update apk add \ autoconf \ build-base \ git \ gmp-dev \ imagemagick-dev \ jpeg-dev \ libpng-dev \ libwebp-dev \ libzip-dev \ Loading
Dockerfile +9 −5 Original line number Diff line number Diff line # syntax = docker/dockerfile:1.0-experimental ARG nginx_version=latest FROM nginx:${nginx_version} as nginx ARG nginx_version ARG php_version FROM nginx:${nginx_version:-latest} as nginx LABEL uk.org.kodo.maintainer = "Dom Sekotill <dom.sekotill@kodo.org.uk>" COPY data/nginx /etc/nginx ARG php_version= FROM php:${php_version:+$php_version-}fpm-alpine as deps RUN --mount=type=bind,source=scripts/install-deps.sh,target=/stage /stage FROM deps as compile RUN --mount=type=bind,source=scripts/compile.sh,target=/stage /stage RUN --mount=type=bind,source=scripts/install-build-deps.sh,target=/stage /stage RUN --mount=type=bind,source=scripts/compile-dist-ext.sh,target=/stage /stage RUN --mount=type=bind,source=scripts/compile-imagick.sh,target=/stage /stage FROM deps as fastcgi LABEL uk.org.kodo.maintainer "Dom Sekotill <dom.sekotill@kodo.org.uk>" ARG wp_version=latest WORKDIR /app ENV WORDPRESS_ROOT=/app Loading @@ -25,6 +27,8 @@ COPY --from=compile /usr/local/etc/php /usr/local/etc/php COPY --from=compile /usr/local/lib/php /usr/local/lib/php COPY scripts/wp.sh /usr/local/bin/wp COPY data/composer.json /app/composer.json ARG wp_version=latest RUN --mount=type=bind,source=scripts/install-wp.sh,target=/stage \ /stage ${wp_version} Loading
README.md +5 −1 Original line number Diff line number Diff line Loading @@ -54,10 +54,14 @@ Build > **Note:** Building manually requires Docker 18.09 or later with the > [Buildkit][] feature enabled. > **Note:** *(Dec 2020)* Currently WP-CLI does not support PHP-8. Likely various plugins and > themes also do not work with PHP-8. Therefore until wider support is available, supply > a PHP-7 version with a build argument. To build the PHP-FPM image run: ```shell DOCKER_BUILDKIT=1 docker build -t wordpress:tag . DOCKER_BUILDKIT=1 docker build -t wordpress:tag --build-arg php_version=7.4.13 . ``` To build the Nginx companion image, run: Loading
scripts/compile.sh→scripts/compile-dist-ext.sh +0 −20 Original line number Diff line number Diff line #!/bin/bash set -eux # Packaged build dependencies BUILD_DEPS=( autoconf build-base gmp-dev imagemagick-dev jpeg-dev libpng-dev libwebp-dev libzip-dev ) # Distributed extensions PHP_EXT=( bcmath Loading @@ -30,10 +18,6 @@ php_version() { return 1 } # Install packaged dependencies apk update apk add "${BUILD_DEPS[@]}" # Build & install distributed extensions if php_version -gt 7.4; then GD_ARGS=( --with-jpeg=/usr --with-webp=/usr ) Loading @@ -42,7 +26,3 @@ else fi docker-php-ext-configure gd "${GD_ARGS[@]}" docker-php-ext-install -j$(nproc) "${PHP_EXT[@]}" # Download, build & install the Image Magick extension pecl install imagick echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini
scripts/compile-imagick.sh 0 → 100755 +11 −0 Original line number Diff line number Diff line #!/bin/bash set -eux cd $(mktemp -d) git clone --depth 1 https://github.com/imagick/imagick.git . phpize ./configure make install echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini
scripts/install-build-deps.sh 0 → 100755 +15 −0 Original line number Diff line number Diff line #!/bin/sh set -eux # Install packaged dependencies apk update apk add \ autoconf \ build-base \ git \ gmp-dev \ imagemagick-dev \ jpeg-dev \ libpng-dev \ libwebp-dev \ libzip-dev \