Skip to content

Commit

Permalink
Add PHP 8.5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Sep 26, 2024
1 parent c1ac4c8 commit 7bc06f0
Show file tree
Hide file tree
Showing 15 changed files with 830 additions and 44 deletions.
200 changes: 173 additions & 27 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ This repository builds `ghcr.io/mvorisek/image-php` image and publishes the foll
- `8.4` `8.4-alpine`
- `8.4-zts` `8.4-zts-alpine`
- `8.4-debug` `8.4-debug-alpine`
- `8.5` `8.5-alpine`
- `8.5-zts` `8.5-zts-alpine`
- `8.5-debug` `8.5-debug-alpine`
- `7.4-debian`
- `7.4-zts-debian`
- `7.4-debug-debian`
Expand All @@ -40,6 +43,9 @@ This repository builds `ghcr.io/mvorisek/image-php` image and publishes the foll
- `8.4-debian`
- `8.4-zts-debian`
- `8.4-debug-debian`
- `8.5-debian`
- `8.5-zts-debian`
- `8.5-debug-debian`
- `7.4-node` `7.4-alpine-node`
- `7.4-zts-node` `7.4-zts-alpine-node`
- `7.4-debug-node` `7.4-debug-alpine-node`
Expand All @@ -58,6 +64,9 @@ This repository builds `ghcr.io/mvorisek/image-php` image and publishes the foll
- `8.4-node` `8.4-alpine-node`
- `8.4-zts-node` `8.4-zts-alpine-node`
- `8.4-debug-node` `8.4-debug-alpine-node`
- `8.5-node` `8.5-alpine-node`
- `8.5-zts-node` `8.5-zts-alpine-node`
- `8.5-debug-node` `8.5-debug-alpine-node`
- `7.4-debian-node`
- `7.4-zts-debian-node`
- `7.4-debug-debian-node`
Expand All @@ -76,6 +85,9 @@ This repository builds `ghcr.io/mvorisek/image-php` image and publishes the foll
- `8.4-debian-node`
- `8.4-zts-debian-node`
- `8.4-debug-debian-node`
- `8.5-debian-node`
- `8.5-zts-debian-node`
- `8.5-debug-debian-node`
- `7.4-selenium` `7.4-alpine-selenium`
- `7.4-zts-selenium` `7.4-zts-alpine-selenium`
- `7.4-debug-selenium` `7.4-debug-alpine-selenium`
Expand All @@ -94,6 +106,9 @@ This repository builds `ghcr.io/mvorisek/image-php` image and publishes the foll
- `8.4-selenium` `8.4-alpine-selenium`
- `8.4-zts-selenium` `8.4-zts-alpine-selenium`
- `8.4-debug-selenium` `8.4-debug-alpine-selenium`
- `8.5-selenium` `8.5-alpine-selenium`
- `8.5-zts-selenium` `8.5-zts-alpine-selenium`
- `8.5-debug-selenium` `8.5-debug-alpine-selenium`
- `7.4-debian-selenium`
- `7.4-zts-debian-selenium`
- `7.4-debug-debian-selenium`
Expand All @@ -112,6 +127,9 @@ This repository builds `ghcr.io/mvorisek/image-php` image and publishes the foll
- `8.4-debian-selenium`
- `8.4-zts-debian-selenium`
- `8.4-debug-debian-selenium`
- `8.5-debian-selenium`
- `8.5-zts-debian-selenium`
- `8.5-debug-debian-selenium`

## Running Locally

Expand Down
2 changes: 1 addition & 1 deletion data/8.4-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUN ! readelf -S /usr/local/bin/php | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name bcmath.so)" | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name xdebug.so)" | grep -q ' \.symtab '
RUN composer diagnose
RUN mkdir t && (cd t && echo '{}' > composer.json && composer config platform.php 8.3 && composer require phpunit/phpunit) && rm -r t/
RUN mkdir t && (cd t && composer require phpunit/phpunit) && rm -r t/


FROM basic as node
Expand Down
2 changes: 1 addition & 1 deletion data/8.4-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RUN ! readelf -S /usr/local/bin/php | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name bcmath.so)" | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name xdebug.so)" | grep -q ' \.symtab '
RUN composer diagnose
RUN mkdir t && (cd t && echo '{}' > composer.json && composer config platform.php 8.3 && composer require phpunit/phpunit) && rm -r t/
RUN mkdir t && (cd t && composer require phpunit/phpunit) && rm -r t/


FROM basic as node
Expand Down
2 changes: 1 addition & 1 deletion data/8.4-debug-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUN readelf -S /usr/local/bin/php | grep -q ' \.symtab ' \
&& readelf -S "$(find /usr/local/lib/php/extensions -name bcmath.so)" | grep -q ' \.symtab ' \
&& readelf -S "$(find /usr/local/lib/php/extensions -name xdebug.so)" | grep -q ' \.symtab '
RUN composer diagnose
RUN mkdir t && (cd t && echo '{}' > composer.json && composer config platform.php 8.3 && composer require phpunit/phpunit) && rm -r t/
RUN mkdir t && (cd t && composer require phpunit/phpunit) && rm -r t/


FROM basic as node
Expand Down
2 changes: 1 addition & 1 deletion data/8.4-debug-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RUN readelf -S /usr/local/bin/php | grep -q ' \.symtab ' \
&& readelf -S "$(find /usr/local/lib/php/extensions -name bcmath.so)" | grep -q ' \.symtab ' \
&& readelf -S "$(find /usr/local/lib/php/extensions -name xdebug.so)" | grep -q ' \.symtab '
RUN composer diagnose
RUN mkdir t && (cd t && echo '{}' > composer.json && composer config platform.php 8.3 && composer require phpunit/phpunit) && rm -r t/
RUN mkdir t && (cd t && composer require phpunit/phpunit) && rm -r t/


FROM basic as node
Expand Down
2 changes: 1 addition & 1 deletion data/8.4-zts-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUN ! readelf -S /usr/local/bin/php | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name bcmath.so)" | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name xdebug.so)" | grep -q ' \.symtab '
RUN composer diagnose
RUN mkdir t && (cd t && echo '{}' > composer.json && composer config platform.php 8.3 && composer require phpunit/phpunit) && rm -r t/
RUN mkdir t && (cd t && composer require phpunit/phpunit) && rm -r t/


FROM basic as node
Expand Down
2 changes: 1 addition & 1 deletion data/8.4-zts-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RUN ! readelf -S /usr/local/bin/php | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name bcmath.so)" | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name xdebug.so)" | grep -q ' \.symtab '
RUN composer diagnose
RUN mkdir t && (cd t && echo '{}' > composer.json && composer config platform.php 8.3 && composer require phpunit/phpunit) && rm -r t/
RUN mkdir t && (cd t && composer require phpunit/phpunit) && rm -r t/


FROM basic as node
Expand Down
103 changes: 103 additions & 0 deletions data/8.5-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
FROM ci-target:base as basic

# install basic system tools
RUN apk update \
&& apk upgrade \
&& apk add bash git make unzip gnupg ca-certificates coreutils \
&& rm -rf /var/cache/apk/* \
&& git config --system --add url."https://github.com/".insteadOf "git@github.com:" \
&& git config --system --add url."https://github.com/".insteadOf "ssh://git@github.com/" \
# fix git repository directory is owned by someone else for Github Actions
&& { echo '#!/bin/sh'; echo 'if [ -n "$GITHUB_WORKSPACE" ] && [ "$(id -u)" -eq 0 ]; then'; echo ' (cd / && /usr/bin/git config --global --add safe.directory "$GITHUB_WORKSPACE")'; echo 'fi'; echo '/usr/bin/git "$@"'; } > /usr/local/bin/git && chmod +x /usr/local/bin/git

# install common PHP extensions
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN git clone --recurse-submodules https://github.com/phpredis/phpredis.git -b develop phpredis \
&& cd phpredis && git reset --hard d3b2d87b10 && rm -r .git
RUN git clone https://github.com/xdebug/xdebug.git -b master xdebug \
&& cd xdebug && git reset --hard 12adc6394a && rm -r .git \
&& sed -E 's~(<max>)[0-9]+.[0-9]+(.99</max>)~\199.99\2~' -i package.xml && sed -E 's~(if test "\$PHP_XDEBUG_FOUND_VERNUM" -ge ")[0-9]+(00"; then)~\19999\2~' -i config.m4
RUN IPE_ICU_EN_ONLY=1 install-php-extensions \
bcmath \
exif \
gd \
gmp \
igbinary \
Imagick/imagick@65e27f2bc0 \
php/pecl-mail-imap@25b62dbf7b \
intl \
mysqli \
php/pecl-database-oci8@74893c6e3d \
opcache \
pcntl \
pdo_mysql \
php/pecl-database-pdo_oci@be8a277c27 \
pdo_pgsql \
pdo_sqlsrv \
$(realpath phpredis) \
sockets \
tidy \
$(realpath xdebug) \
xsl \
zip \
# remove Ghostscript binary, reduce Alpine image size by 23 MB, remove once https://gitlab.alpinelinux.org/alpine/aports/-/issues/13415 is fixed
&& rm /usr/bin/gs \
# pack Oracle Instant Client libs, reduce image size by 85 MB
&& rm /usr/lib/oracle/*/client64/lib/*.jar && tar -czvf /usr/lib/oracle-pack.tar.gz -C / /usr/lib/oracle /usr/local/etc/php/conf.d/docker-php-ext-pdo_oci.ini /usr/local/etc/php/conf.d/docker-php-ext-oci8.ini && rm -r /usr/lib/oracle/* /usr/local/etc/php/conf.d/docker-php-ext-pdo_oci.ini /usr/local/etc/php/conf.d/docker-php-ext-oci8.ini && mv /usr/lib/oracle-pack.tar.gz /usr/lib/oracle/pack.tar.gz \
&& { echo '#!/bin/sh'; echo 'if [ ! -d /usr/lib/oracle/*/client64 ]; then'; echo ' tar -xzf /usr/lib/oracle/pack.tar.gz -C / && rm /usr/lib/oracle/pack.tar.gz'; echo 'fi'; } > /usr/lib/oracle/setup.sh && chmod +x /usr/lib/oracle/setup.sh

# install Composer
RUN install-php-extensions @composer

FROM basic as basic__test
RUN php --version
COPY test.php ./
RUN (/usr/lib/oracle/setup.sh || true) && php test.php
RUN php -n -r 'exit(!ZEND_DEBUG_BUILD ? 0 : 1);'
RUN apk update \
&& apk add binutils \
&& rm -rf /var/cache/apk/*
RUN ! readelf -S /usr/local/bin/php | grep -q ' \.symtab ' \
&& ! readelf -S /usr/local/lib/libphp.so | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name bcmath.so)" | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name xdebug.so)" | grep -q ' \.symtab '
RUN composer diagnose
RUN mkdir t && (cd t && echo '{}' > composer.json && composer config platform.php 8.4 && composer require phpunit/phpunit) && rm -r t/


FROM basic as node

# install Node JS with npm
RUN apk update \
&& apk add nodejs npm \
&& rm -rf /var/cache/apk/*

FROM node as node__test
RUN npm version
RUN mkdir t && (cd t && npm install mocha) && rm -r t/


FROM node as selenium

# install Selenium
RUN apk update \
&& apk add openjdk17-jre-headless xvfb ttf-freefont \
&& rm -rf /var/cache/apk/* \
&& curl --fail --silent --show-error -L "https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar" -o /opt/selenium-server-standalone.jar

# install Chrome
RUN apk update \
&& apk add chromium chromium-chromedriver nss-tools \
&& rm -rf /var/cache/apk/*

# install Firefox
RUN apk update \
&& apk add firefox \
&& rm -rf /var/cache/apk/* \
&& curl --fail --silent --show-error -L "https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz" -o /tmp/geckodriver.tar.gz \
&& tar -C /opt -zxf /tmp/geckodriver.tar.gz && rm /tmp/geckodriver.tar.gz \
&& chmod 755 /opt/geckodriver && ln -s /opt/geckodriver /usr/bin/geckodriver

FROM selenium as selenium__test
RUN chromium-browser --version
RUN firefox --version
103 changes: 103 additions & 0 deletions data/8.5-debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
FROM ci-target:base as basic

# install basic system tools
RUN (seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{}) \
&& apt-get -y update \
&& apt-get -y upgrade \
&& apt-get -y install bash git make unzip gnupg ca-certificates apt-utils apt-transport-https netcat-traditional \
&& apt-get purge -y --auto-remove && apt-get clean && rm -rf /var/lib/apt/lists/* \
&& git config --system --add url."https://github.com/".insteadOf "git@github.com:" \
&& git config --system --add url."https://github.com/".insteadOf "ssh://git@github.com/" \
# fix git repository directory is owned by someone else for Github Actions
&& { echo '#!/bin/sh'; echo 'if [ -n "$GITHUB_WORKSPACE" ] && [ "$(id -u)" -eq 0 ]; then'; echo ' (cd / && /usr/bin/git config --global --add safe.directory "$GITHUB_WORKSPACE")'; echo 'fi'; echo '/usr/bin/git "$@"'; } > /usr/local/bin/git && chmod +x /usr/local/bin/git

# install common PHP extensions
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN git clone --recurse-submodules https://github.com/phpredis/phpredis.git -b develop phpredis \
&& cd phpredis && git reset --hard d3b2d87b10 && rm -r .git
RUN git clone https://github.com/xdebug/xdebug.git -b master xdebug \
&& cd xdebug && git reset --hard 12adc6394a && rm -r .git \
&& sed -E 's~(<max>)[0-9]+.[0-9]+(.99</max>)~\199.99\2~' -i package.xml && sed -E 's~(if test "\$PHP_XDEBUG_FOUND_VERNUM" -ge ")[0-9]+(00"; then)~\19999\2~' -i config.m4
RUN IPE_ICU_EN_ONLY=1 install-php-extensions \
bcmath \
exif \
gd \
gmp \
igbinary \
Imagick/imagick@65e27f2bc0 \
php/pecl-mail-imap@25b62dbf7b \
intl \
mysqli \
php/pecl-database-oci8@74893c6e3d \
opcache \
pcntl \
pdo_mysql \
php/pecl-database-pdo_oci@be8a277c27 \
pdo_pgsql \
pdo_sqlsrv \
$(realpath phpredis) \
sockets \
tidy \
$(realpath xdebug) \
xsl \
zip \
# pack Oracle Instant Client libs, reduce image size by 85 MB
&& rm /usr/lib/oracle/*/client64/lib/*.jar && tar -czvf /usr/lib/oracle-pack.tar.gz -C / /usr/lib/oracle /usr/local/etc/php/conf.d/docker-php-ext-pdo_oci.ini /usr/local/etc/php/conf.d/docker-php-ext-oci8.ini && rm -r /usr/lib/oracle/* /usr/local/etc/php/conf.d/docker-php-ext-pdo_oci.ini /usr/local/etc/php/conf.d/docker-php-ext-oci8.ini && mv /usr/lib/oracle-pack.tar.gz /usr/lib/oracle/pack.tar.gz \
&& { echo '#!/bin/sh'; echo 'if [ ! -d /usr/lib/oracle/*/client64 ]; then'; echo ' tar -xzf /usr/lib/oracle/pack.tar.gz -C / && rm /usr/lib/oracle/pack.tar.gz'; echo 'fi'; } > /usr/lib/oracle/setup.sh && chmod +x /usr/lib/oracle/setup.sh

# install Composer
RUN install-php-extensions @composer

FROM basic as basic__test
RUN php --version
COPY test.php ./
RUN (/usr/lib/oracle/setup.sh || true) && php test.php
RUN php -n -r 'exit(!ZEND_DEBUG_BUILD ? 0 : 1);'
RUN apt-get -y update \
&& apt-get -y install binutils \
&& apt-get purge -y --auto-remove && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN ! readelf -S /usr/local/bin/php | grep -q ' \.symtab ' \
&& ! readelf -S /usr/local/lib/libphp.so | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name bcmath.so)" | grep -q ' \.symtab ' \
&& ! readelf -S "$(find /usr/local/lib/php/extensions -name xdebug.so)" | grep -q ' \.symtab '
RUN composer diagnose
RUN mkdir t && (cd t && echo '{}' > composer.json && composer config platform.php 8.4 && composer require phpunit/phpunit) && rm -r t/


FROM basic as node

# install Node JS with npm
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get -y update \
&& apt-get -y install nodejs \
&& apt-get purge -y --auto-remove && apt-get clean && rm -rf /var/lib/apt/lists/* && npm install --global npm@latest

FROM node as node__test
RUN npm version
RUN mkdir t && (cd t && npm install mocha) && rm -r t/


FROM node as selenium

# install Selenium
RUN apt-get -y update \
&& apt-get -y install openjdk-17-jre-headless xvfb fonts-freefont-ttf \
&& apt-get purge -y --auto-remove && apt-get clean && rm -rf /var/lib/apt/lists/* \
&& curl --fail --silent --show-error -L "https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar" -o /opt/selenium-server-standalone.jar

# install Chrome
RUN apt-get -y update \
&& apt-get -y install chromium chromium-driver libnss3-tools \
&& apt-get purge -y --auto-remove && apt-get clean && rm -rf /var/lib/apt/lists/*

# install Firefox
RUN apt-get -y update \
&& apt-get -y install firefox-esr \
&& apt-get purge -y --auto-remove && apt-get clean && rm -rf /var/lib/apt/lists/* \
&& curl --fail --silent --show-error -L "https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz" -o /tmp/geckodriver.tar.gz \
&& tar -C /opt -zxf /tmp/geckodriver.tar.gz && rm /tmp/geckodriver.tar.gz \
&& chmod 755 /opt/geckodriver && ln -s /opt/geckodriver /usr/bin/geckodriver

FROM selenium as selenium__test
RUN chromium --version
RUN firefox --version
Loading

0 comments on commit 7bc06f0

Please sign in to comment.