From dccaf1e63a3af5321c83f7ee1cdb534b6aadc8fb Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Tue, 15 Aug 2023 12:18:09 +0200 Subject: [PATCH] build(.githug, containers/wordpress) remedy PHP 7.4 missing wp 6.2 support --- .github/workflows/publish-wordpress-docker-image.yml | 9 +++++++-- containers/wordpress/Dockerfile | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-wordpress-docker-image.yml b/.github/workflows/publish-wordpress-docker-image.yml index dfc3ed7..f8cfca1 100644 --- a/.github/workflows/publish-wordpress-docker-image.yml +++ b/.github/workflows/publish-wordpress-docker-image.yml @@ -17,11 +17,16 @@ jobs: strategy: matrix: wp_version: [ '6.2' ] - php_version: [ '7.4', '8.0', '8.1', '8.2' ] + php_version: [ '8.0', '8.1', '8.2' ] include: - # WordPress did not publish any 6.x images for PHP 7.3, use the latest 5.9 patch. + # No WordPress image for version 6.2+ and PHP 7.3: use the latest 5.9 version. + # This version is NOT udpated in the containers/wordpress/Dockerfile for back-compatibility. - wp_version: '5.9' php_version: '7.3' + # No WordPress image for version 6.2+ and PHP 7.4: use the latest 6.1.1 version. + # See containers/wordpress/Dockerfile for the wp-cli update to version 6.2. + - wp_version: '6.1.1' + php_version: '7.4' steps: - name: Checkout repository diff --git a/containers/wordpress/Dockerfile b/containers/wordpress/Dockerfile index b823ea1..7ae5e54 100644 --- a/containers/wordpress/Dockerfile +++ b/containers/wordpress/Dockerfile @@ -13,3 +13,13 @@ RUN chmod a+x /usr/local/bin/xdebug-on && \ RUN chmod -R a+rwx /usr/local/etc/php/conf.d # Use our own ini configuration file to set up some PHP default. COPY ./php.ini /usr/local/etc/php/conf.d/999-slic.ini + +# Install and make wp-cli binary available and executable by all users. +ADD https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar /usr/local/bin/wp +RUN chmod a+rx /usr/local/bin/wp + +# If PHP_VERSION is 7.4, the use wp-cli to update wordpress to version 6.2. +# No image is available for wordpress 6.2 with PHP 7.4: this works around the issue. +RUN if [ "${PHP_VERSION}" = "7.4" ]; then \ + wp core update --version=6.2 --force; \ + fi