Add PHP 8.5 support

Update the quick-build matrix to PHP 8.1 through 8.5 and define the
workspace85 Compose service.

Use Xdebug 3.5 on PHP 8.5 and adjust shared image setup for
version-specific OPcache and bundled extensions. Also correct the
post_max_size setting and make apt cleanup commands portable.
This commit is contained in:
WP Studio
2026-10-22 16:37:20 +03:00
parent b86367fd69
commit 1100b747df
5 changed files with 52 additions and 17 deletions

View File

@ -1 +1 @@
PHP_VERSIONS=(74 81 82 83)
PHP_VERSIONS=(81 82 83 84 85)

View File

@ -65,3 +65,9 @@ services:
service: workspace
build:
dockerfile: workspace/workspace84.Dockerfile
workspace85:
extends:
file: docker-compose.base.yml
service: workspace
build:
dockerfile: workspace/workspace85.Dockerfile

View File

@ -33,16 +33,25 @@ RUN locale-gen en_US.UTF-8
# Install PHP-extensions:
###########################################################################
RUN docker-php-ext-install -j$(nproc) iconv
# iconv and pdo are compiled statically into the official images (7.4 - 8.5),
# so there is nothing to install/enable for them
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && \
docker-php-ext-install -j$(nproc) gd
# opcache already installed and only need enable to
RUN docker-php-ext-enable opcache
# opcache:
# - PHP 7.4: shared module (opcache.so), but not enabled in the official image
# - PHP 8.0-8.4: shared module (opcache.so), already enabled in the official image
# - PHP 8.5+: compiled statically into the PHP binary (no opcache.so at all)
# That is why it is enabled only when it is really missing
RUN if php -m | grep -q "^Zend OPcache$"; then \
echo "Opcache is already built into PHP: $(php -r 'echo PHP_VERSION;')"; \
else \
docker-php-ext-enable opcache; \
fi
# some extension already loaded by default (of course if or after is installed)
ARG EXTENSIONS='pdo intl mysqli pgsql zip bcmath bz2 pdo_mysql pdo_pgsql'
ARG EXTENSIONS='intl mysqli pgsql zip bcmath bz2 pdo_mysql pdo_pgsql'
# Extension automatic enable in helper install script
# See: https://github.com/devilbox/docker-php-fpm-7.4/blob/master/data/docker-php-ext-install#L111
@ -55,12 +64,22 @@ RUN docker-php-ext-install ${EXTENSIONS}
# For PHP 7.4 xdebug 3.1 also is supported, but staty xdebug 2 version for compatibility experiences
# See https://xdebug.org/docs/compat
# And see exactly xdebug minor versions: https://pecl.php.net/package/xdebug
# Xdebug is bound to a PHP version range, so the version is picked by the PHP minor version:
# 3.5.x -> PHP 8.5
# 3.4.x -> PHP 8.0 - 8.4
# 2.9.x -> PHP 7.x
ARG XDEBUG_VERSION_PHP8_5=3.5.3
ARG XDEBUG_VERSION_PHP8=3.4.1
ARG XDEBUG_VERSION_PHP7=2.9.8
RUN PHP_MAJOR_VERSION=$(php -r 'echo PHP_MAJOR_VERSION;') && \
PHP_MINOR_VERSION=$(php -r 'echo PHP_MINOR_VERSION;') && \
if [ $PHP_MAJOR_VERSION = '8' ]; then \
pecl install xdebug-3.4.1; \
elif [ $PHP_MAJOR_VERSION = '7' ]; then \
pecl install xdebug-2.9.8; \
if [ "$PHP_MAJOR_VERSION" = '8' ] && [ "$PHP_MINOR_VERSION" -ge 5 ]; then \
pecl install xdebug-${XDEBUG_VERSION_PHP8_5}; \
elif [ "$PHP_MAJOR_VERSION" = '8' ]; then \
pecl install xdebug-${XDEBUG_VERSION_PHP8}; \
elif [ "$PHP_MAJOR_VERSION" = '7' ]; then \
pecl install xdebug-${XDEBUG_VERSION_PHP7}; \
else \
echo "Not support that major PHP version: $PHP_MAJOR_VERSION"; \
exit 1; \
@ -97,7 +116,7 @@ ARG PHP_OPT_MEMORY_LIMIT=256M
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_POST_MAX_SIZE=300M
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=100M
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
@ -112,6 +131,6 @@ RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTI
#
# Clean up
RUN apt clean && \
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
rm /var/log/lastlog /var/log/faillog
rm -f /var/log/lastlog /var/log/faillog

View File

@ -33,12 +33,22 @@ SHELL ["/bin/sh", "-c"]
# xDebug:
###########################################################################
# Xdebug is bound to a PHP version range, so the version is picked by the PHP minor version:
# 3.5.x -> PHP 8.5
# 3.4.x -> PHP 8.0 - 8.4
# 2.9.x -> PHP 7.x
ARG XDEBUG_VERSION_PHP8_5=3.5.3
ARG XDEBUG_VERSION_PHP8=3.4.1
ARG XDEBUG_VERSION_PHP7=2.9.8
RUN PHP_MAJOR_VERSION=$(php -r 'echo PHP_MAJOR_VERSION;') && \
PHP_MINOR_VERSION=$(php -r 'echo PHP_MINOR_VERSION;') && \
if [ $PHP_MAJOR_VERSION = '8' ]; then \
pecl install xdebug-3.4.1; \
elif [ $PHP_MAJOR_VERSION = '7' ]; then \
pecl install xdebug-2.9.8; \
if [ "$PHP_MAJOR_VERSION" = '8' ] && [ "$PHP_MINOR_VERSION" -ge 5 ]; then \
pecl install xdebug-${XDEBUG_VERSION_PHP8_5}; \
elif [ "$PHP_MAJOR_VERSION" = '8' ]; then \
pecl install xdebug-${XDEBUG_VERSION_PHP8}; \
elif [ "$PHP_MAJOR_VERSION" = '7' ]; then \
pecl install xdebug-${XDEBUG_VERSION_PHP7}; \
else \
echo "Not support that major PHP version: $PHP_MAJOR_VERSION"; \
exit 1; \

View File

@ -3,7 +3,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/.."
PHP_VERSIONS=(74 81 82 83)
PHP_VERSIONS=(81 82 83 84 85)
set -e