Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 8.3(-RC) containers #113

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 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' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
env:
PHP_VERSION: ${{ matrix.php }}
PHP_LATEST: '7.4'
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' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]

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

env:
PHPUNIT_VERSION: ${{ matrix.phpunit }}
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' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]

env:
PHP_VERSION: ${{ matrix.php }}
Expand Down
8 changes: 4 additions & 4 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' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
env:
PHP_VERSION: ${{ matrix.php }}
PHP_LATEST: '7.4'
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' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]

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

env:
PHPUNIT_VERSION: ${{ matrix.phpunit }}
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' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]

env:
PHP_VERSION: ${{ matrix.php }}
Expand Down
40 changes: 40 additions & 0 deletions images/8.3/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.3-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.3/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.3/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
FROM php:8.3-rc-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.3/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.3/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.3/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.3/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.3-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.3/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 "$@"
22 changes: 22 additions & 0 deletions images/phpunit/9-php-8.3/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.3-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/phpunit/9-php-8.3/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 "$@"
15 changes: 15 additions & 0 deletions update.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,20 @@
'download_url' => 'https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar',
),
),
'8.3' => array(
'php' => array(
'base_name' => 'php:8.3-rc-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 Expand Up @@ -261,6 +275,7 @@
*/
$phpunit_versions = array(
'9' => array(
'8.3',
'8.2',
'8.1',
'8.0',
Expand Down