Skip to content

Commit cb5ee85

Browse files
committed
Fix PHP 8.5 build: opcache is built-in
From PHP 8.5, opcache is a built-in feature and the php8.5-opcache package doesn't exist. Conditionally include the opcache package only for PHP versions other than 8.5.
1 parent 7d96164 commit cb5ee85

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

Dockerfile.slim.apache

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ RUN apt update \
4949
openssh-client \
5050
&& apt clean \
5151
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
52-
RUN apt update \
52+
# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist
53+
RUN OPCACHE_PACKAGE="" \
54+
&& if [ "${PHP_VERSION}" != "8.5" ]; then \
55+
OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \
56+
fi \
57+
&& apt update \
5358
&& apt install -y --no-install-recommends \
5459
php${PHP_VERSION}-cli \
5560
php${PHP_VERSION}-curl \
5661
php${PHP_VERSION}-mbstring \
57-
php${PHP_VERSION}-opcache \
62+
${OPCACHE_PACKAGE} \
5863
php${PHP_VERSION}-readline \
5964
php${PHP_VERSION}-xml \
6065
php${PHP_VERSION}-zip \

Dockerfile.slim.cli

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ RUN apt update \
4949
openssh-client \
5050
&& apt clean \
5151
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
52-
RUN apt update \
52+
# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist
53+
RUN OPCACHE_PACKAGE="" \
54+
&& if [ "${PHP_VERSION}" != "8.5" ]; then \
55+
OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \
56+
fi \
57+
&& apt update \
5358
&& apt install -y --no-install-recommends \
5459
php${PHP_VERSION}-cli \
5560
php${PHP_VERSION}-curl \
5661
php${PHP_VERSION}-mbstring \
57-
php${PHP_VERSION}-opcache \
62+
${OPCACHE_PACKAGE} \
5863
php${PHP_VERSION}-readline \
5964
php${PHP_VERSION}-xml \
6065
php${PHP_VERSION}-zip \

Dockerfile.slim.fpm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ RUN apt update \
4949
openssh-client \
5050
&& apt clean \
5151
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
52-
RUN apt update \
52+
# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist
53+
RUN OPCACHE_PACKAGE="" \
54+
&& if [ "${PHP_VERSION}" != "8.5" ]; then \
55+
OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \
56+
fi \
57+
&& apt update \
5358
&& apt install -y --no-install-recommends \
5459
php${PHP_VERSION}-cli \
5560
php${PHP_VERSION}-curl \
5661
php${PHP_VERSION}-mbstring \
57-
php${PHP_VERSION}-opcache \
62+
${OPCACHE_PACKAGE} \
5863
php${PHP_VERSION}-readline \
5964
php${PHP_VERSION}-xml \
6065
php${PHP_VERSION}-zip \

utils/Dockerfile.slim.blueprint

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,17 @@ RUN apt update \
4848
openssh-client \
4949
&& apt clean \
5050
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
51-
RUN apt update \
51+
# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist
52+
RUN OPCACHE_PACKAGE="" \
53+
&& if [ "${PHP_VERSION}" != "8.5" ]; then \
54+
OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \
55+
fi \
56+
&& apt update \
5257
&& apt install -y --no-install-recommends \
5358
php${PHP_VERSION}-cli \
5459
php${PHP_VERSION}-curl \
5560
php${PHP_VERSION}-mbstring \
56-
php${PHP_VERSION}-opcache \
61+
${OPCACHE_PACKAGE} \
5762
php${PHP_VERSION}-readline \
5863
php${PHP_VERSION}-xml \
5964
php${PHP_VERSION}-zip \

0 commit comments

Comments
 (0)