From 12f6e099cf8658e8c49b8c18cbf18445e3fb729f Mon Sep 17 00:00:00 2001 From: ma-04 <120931948+ma-04@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:12:11 +0600 Subject: [PATCH] fix: install WP-CLI nightly so core download works with WordPress 7 WP-CLI 2.12.0 (latest stable) cannot extract WordPress 7.0.x archives (wp-cli/wp-cli#6320, #6396); the fix is only in nightly builds so far. Both the PHP and OpenLiteSpeed images now download wp-cli-nightly.phar. The doctor package was installed with @stable, which resolved to v2.3.1 and vendored the 2.x framework, core-command and legacy mustache into the packages dir. With the 3.0 nightly that fatals on every command. The packages dir now uses a composer.json that replaces the framework and bundled commands, so only doctor-command v3 is vendored and the phar's classes are used. Move back to wp-cli.phar once a fixed stable release ships. --- openlitespeed/Dockerfile | 4 ++-- php/Dockerfile | 9 +++++---- php/wp-cli-packages.json | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 php/wp-cli-packages.json diff --git a/openlitespeed/Dockerfile b/openlitespeed/Dockerfile index 5d504a2..42d4bf0 100644 --- a/openlitespeed/Dockerfile +++ b/openlitespeed/Dockerfile @@ -41,10 +41,10 @@ RUN wget -O - https://repo.litespeed.sh | bash \ rm -rf /var/lib/apt/lists/* && \ apt-get clean && apt-get autoremove -y -# Install Composer and WP-CLI +# Install Composer and WP-CLI (nightly until a stable release fixes https://github.com/wp-cli/wp-cli/issues/6396) RUN wget -qO /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar \ && chmod +x /usr/local/bin/composer \ - && wget -qO /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ + && wget -qO /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar \ && chmod +x /usr/local/bin/wp \ && echo "alias wp='wp --allow-root'" >> /root/.bashrc diff --git a/php/Dockerfile b/php/Dockerfile index 6517aa2..3b9227b 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -9,16 +9,17 @@ RUN apk add --no-cache curl \ && rm -rf /var/cache/apk/* # Stage for WP-CLI +# Nightly build: the latest stable (2.12.0) breaks `wp core download` for WordPress 7 +# (https://github.com/wp-cli/wp-cli/issues/6396). Move back to wp-cli.phar once a fixed stable ships. FROM php:${PHP_VERSION}-cli-alpine AS wpcli_builder +COPY wp-cli-packages.json /root/.wp-cli/packages/composer.json RUN apk add --no-cache curl unzip \ && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ - && curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ + && curl -fsSLo wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar \ && chmod +x wp-cli.phar \ && mv wp-cli.phar /usr/local/bin/wp \ - && mkdir -p /root/.wp-cli/packages \ && cd /root/.wp-cli/packages \ - && composer init --name=wp-cli/wp-cli-packages --stability=stable --no-interaction \ - && composer require wp-cli/doctor-command:@stable --prefer-dist --no-interaction \ + && composer require wp-cli/doctor-command:^3 --prefer-dist --no-interaction \ && mkdir -p /home/www-data/.wp-cli \ && mv /root/.wp-cli/packages /home/www-data/.wp-cli/ \ && chown -R www-data:www-data /home/www-data/.wp-cli \ diff --git a/php/wp-cli-packages.json b/php/wp-cli-packages.json new file mode 100644 index 0000000..a06e000 --- /dev/null +++ b/php/wp-cli-packages.json @@ -0,0 +1,15 @@ +{ + "name": "wp-cli/wp-cli-packages", + "description": "WP-CLI packages. The framework and bundled commands come from the wp-cli phar, so they are replaced here to keep a second copy out of vendor/.", + "minimum-stability": "dev", + "prefer-stable": true, + "replace": { + "wp-cli/wp-cli": "*", + "wp-cli/checksum-command": "*", + "wp-cli/core-command": "*", + "wp-cli/cron-command": "*", + "wp-cli/entity-command": "*", + "wp-cli/extension-command": "*", + "wp-cli/language-command": "*" + } +}