Skip to content

Commit

Permalink
Add PHP 8.4 images.
Browse files Browse the repository at this point in the history
  • Loading branch information
desrosj committed Jul 26, 2024
1 parent ea78658 commit 3db75a3
Show file tree
Hide file tree
Showing 11 changed files with 211 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

strategy:
matrix:
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
env:
PHP_VERSION: ${{ matrix.php }}
PHP_LATEST: '8.2'
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
needs: build-php-images
strategy:
matrix:
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]

env:
PHP_VERSION: ${{ matrix.php }}
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
needs: build-php-images
strategy:
matrix:
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]

env:
PHP_VERSION: ${{ matrix.php }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/github-container-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
needs: [ check-for-changes ]
strategy:
matrix:
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
env:
PHP_VERSION: ${{ matrix.php }}
PHP_LATEST: '8.2'
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
needs: build-php-images
strategy:
matrix:
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]

env:
PHP_VERSION: ${{ matrix.php }}
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
needs: build-php-images
strategy:
matrix:
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]

env:
PHP_VERSION: ${{ matrix.php }}
Expand Down
40 changes: 40 additions & 0 deletions images/8.4/cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
ARG PACKAGE_REGISTRY
ARG PR_TAG
FROM $PACKAGE_REGISTRY/php:8.4-fpm$PR_TAG

##########################################################################
#
# WARNING: This file was generated by update.php.
#
# You can find the relevant template in the `/templates` folder.
#


# install wp-cli dependences
RUN set -ex; \
\
apt-get update; \
\
apt-get install -y --no-install-recommends \
less \
virtual-mysql-client \
;

RUN set -ex; \
\
curl -L -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; \
\
chmod +x /usr/local/bin/wp; \
\
wp --allow-root --version;

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]


WORKDIR /var/www

CMD [ "wp", "shell" ]
17 changes: 17 additions & 0 deletions images/8.4/cli/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e

source /common.sh

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- wp "$@"
fi

# if our command is a valid wp-cli subcommand, let's invoke it through wp-cli instead
if sudo -u wp_php wp --path=/dev/null help "$1" > /dev/null 2>&1; then
set -- wp "$@"
fi

# Execute CMD
sudo -E -u wp_php "$@"
63 changes: 63 additions & 0 deletions images/8.4/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
FROM php:8.3-fpm

WORKDIR /var/www

##########################################################################
#
# WARNING: This file was generated by update.php.
#
# You can find the relevant template in the `/templates` folder.
#

ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /tmp

# install the PHP extensions we need
RUN set -ex; \
\
apt-get update; \
\
apt-get install -y --no-install-recommends libjpeg-dev libpng-dev libwebp-dev libzip-dev libmemcached-dev unzip libmagickwand-dev ghostscript libonig-dev locales sudo rsync libxslt-dev git; \
apt-get upgrade openssl -y; \
update-ca-certificates --fresh; \
sed -i 's/^# *\(\(ru_RU\|fr_FR\|de_DE\|es_ES\|ja_JP\).UTF-8\)/\1/' /etc/locale.gen; \
locale-gen; \
\
docker-php-ext-configure gd --enable-gd --with-jpeg=/usr --with-webp=/usr; \
\
docker-php-ext-install gd opcache mysqli zip exif intl mbstring xml xsl; \
\
curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer; \
curl --silent --fail --location --retry 3 --output /tmp/installer.sig --url https://composer.github.io/installer.sig; \
php -r " \
\$signature = file_get_contents( '/tmp/installer.sig' ); \
\$hash = hash( 'sha384', file_get_contents('/tmp/installer.php') ); \
if ( \$signature !== \$hash ) { \
unlink( '/tmp/installer.php' ); \
unlink( '/tmp/installer.sig' ); \
echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
exit( 1 ); \
}"; \
php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer; \
composer --ansi --version --no-interaction; \
rm -f /tmp/installer.php /tmp/installer.sig;

COPY entrypoint.sh /entrypoint.sh
COPY common.sh /common.sh
COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-wordpress.conf

ARG imagemagic_config=/etc/ImageMagick-6/policy.xml
RUN if [ -f $imagemagic_config ] ; then \
sed -i 's/<policy domain="coder" rights="none" pattern="PDF" \/>/<policy domain="coder" rights="read|write" pattern="PDF" \/>/g' $imagemagic_config; \
else \
echo did not see file $imagemagic_config; \
fi

RUN chmod +x /entrypoint.sh && \
chmod +x /common.sh && \
groupadd -g 1000 -r wp_php && \
useradd -u 1000 -s /bin/bash -g wp_php wp_php

ENTRYPOINT [ "/entrypoint.sh" ]

CMD [ "php-fpm" ]
30 changes: 30 additions & 0 deletions images/8.4/php/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e

# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled
if [ "$LOCAL_PHP_XDEBUG" = true ]; then
docker-php-ext-enable xdebug
rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
else
docker-php-ext-enable opcache
rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
fi

# If LOCAL_PHP_MEMCACHED=true memcached extension will be enabled
if [ "$LOCAL_PHP_MEMCACHED" = true ]; then
docker-php-ext-enable memcached
else
rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini
fi

### Change UID/GID
WP_PHP_UID="${PHP_FPM_UID-1000}"
WP_PHP_GID="${PHP_FPM_GID-1000}"

if [ "$WP_PHP_UID" != "`id -u wp_php`" ]; then
usermod -o -u "${WP_PHP_UID}" "wp_php"
fi

if [ "$WP_PHP_GID" != "`id -g wp_php`" ]; then
groupmod -o -g "${WP_PHP_GID}" "wp_php"
fi
7 changes: 7 additions & 0 deletions images/8.4/php/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

source /common.sh

# Execute CMD
exec "$@"
3 changes: 3 additions & 0 deletions images/8.4/php/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[www]
user = wp_php
group = wp_php
22 changes: 22 additions & 0 deletions images/8.4/phpunit/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG PACKAGE_REGISTRY
ARG PR_TAG
FROM $PACKAGE_REGISTRY/php:8.4-fpm$PR_TAG

##########################################################################
#
# WARNING: This file was generated by update.php.
#
# You can find the relevant template in the `/templates` folder.
#

RUN curl -sL https://phar.phpunit.de/phpunit-9.phar > /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit

WORKDIR /var/www

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]

CMD /usr/local/bin/phpunit
9 changes: 9 additions & 0 deletions images/8.4/phpunit/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

source /common.sh

chown -R wp_php:wp_php /var/www/${LOCAL_DIR-src}/wp-content/uploads

# Execute CMD
sudo -E -u wp_php "$@"
14 changes: 14 additions & 0 deletions update.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,20 @@
'download_url' => 'https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar',
),
),
'8.4' => array(
'php' => array(
'base_name' => 'php:8.3-fpm',
'apt' => array( 'libjpeg-dev', 'libpng-dev', 'libwebp-dev', 'libzip-dev', 'libmemcached-dev', 'unzip', 'libmagickwand-dev', 'ghostscript', 'libonig-dev', 'locales', 'sudo', 'rsync', 'libxslt-dev' ),
'extensions' => array( 'gd', 'opcache', 'mysqli', 'zip', 'exif', 'intl', 'mbstring', 'xml', 'xsl' ),
'pecl_extensions' => array(),
'composer' => true,
),
'phpunit' => 9,
'cli' => array(
'mysql_client' => 'virtual-mysql-client',
'download_url' => 'https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar',
),
),
);

/**
Expand Down

0 comments on commit 3db75a3

Please sign in to comment.