Skip to content

Commit

Permalink
Add images for PHP 8.0 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
pento authored Aug 7, 2019
1 parent a43620a commit afb6aea
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 8 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ jobs:
- docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG 7.4/php
- docker images
- docker push $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG
- name: "php 8.0"
script:
- docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG 8.0/php
- docker images
- docker push $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG

- stage: "Build child images"
name: "phpunit 5.2"
Expand Down Expand Up @@ -140,6 +145,11 @@ jobs:
- docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.4-fpm$PR_TAG 7.4/phpunit
- docker images
- docker push $PACKAGE_REGISTRY/phpunit:7.4-fpm$PR_TAG
- name: "phpunit 8.0"
script:
- docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:8.0-fpm$PR_TAG 8.0/phpunit
- docker images
- docker push $PACKAGE_REGISTRY/phpunit:8.0-fpm$PR_TAG

- name: "cli 5.2"
script:
Expand Down Expand Up @@ -192,4 +202,9 @@ jobs:
- docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.4-fpm$PR_TAG 7.4/cli
- docker images
- docker push $PACKAGE_REGISTRY/cli:7.4-fpm$PR_TAG
- name: "cli 8.0"
script:
- docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:8.0-fpm$PR_TAG 8.0/cli
- docker images
- docker push $PACKAGE_REGISTRY/cli:8.0-fpm$PR_TAG

35 changes: 35 additions & 0 deletions 8.0/cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ARG PACKAGE_REGISTRY
ARG PR_TAG
FROM $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG

##########################################################################
#
# WARNING: This file was generated by update.php. Do not edit it directly.
#
#


# 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;

ENTRYPOINT [ "/usr/local/bin/wp", "--allow-root" ]


WORKDIR /var/www

CMD [ "shell" ]
21 changes: 21 additions & 0 deletions 8.0/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM devilbox/php-fpm-8.0:latest

##########################################################################
#
# WARNING: This file was generated by update.php. Do not edit it directly.
#
#

# install the PHP extensions we need
RUN set -ex; \
\
\
docker-php-ext-install mysqli;

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]

CMD [ "php-fpm" ]
14 changes: 14 additions & 0 deletions 8.0/php/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/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

# Execute CMD
exec "$@"
15 changes: 15 additions & 0 deletions 8.0/phpunit/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG PACKAGE_REGISTRY
ARG PR_TAG
FROM $PACKAGE_REGISTRY/php:8.0-fpm$PR_TAG

##########################################################################
#
# WARNING: This file was generated by update.php. Do not edit it directly.
#
#

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

WORKDIR /wordpress-develop

CMD /usr/local/bin/phpunit
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ After modifying any of the Dockerfile template files, you'll need to regenerate

When submitting a Pull Request, images will be automatically built for you, and hosted on the GitHub Package Registry. As this service is currently in beta, you will need to login to the package registry, even for pulling images. You can read more about this in the [GitHub Package Registry documentation](https://help.github.com/en/articles/configuring-docker-for-use-with-github-package-registry).

Once Travis finishes building all of these packages, you can modify [`docker-compose.yml`](WordPress/wordpress-develop/tools/local-env/docker-compose.yml) and [`docker-compose.scripts.yml`](WordPress/wordpress-develop/tools/local-env/docker-compose.scripts.yml) to pull from GitHub. For example, the `image` in the PHP container would change from `wordpressdevelop/php:${LOCAL_PHP-latest}` to `docker.pkg.github.com/wordpress/wpdev-docker-images/php:${LOCAL_PHP-latest}-PR_NUMBER`, where `PR_NUMBER` is the number of the Pull Request you submitted.
Once Travis finishes building all of these packages, you can modify [`docker-compose.yml`](https://github.com/WordPress/wordpress-develop/blob/master/tools/local-env/docker-compose.yml) and [`docker-compose.scripts.yml`](https://github.com/WordPress/wordpress-develop/blob/master/tools/local-env/docker-compose.scripts.yml) to pull from GitHub. For example, the `image` in the PHP container would change from `wordpressdevelop/php:${LOCAL_PHP-latest}` to `docker.pkg.github.com/wordpress/wpdev-docker-images/php:${LOCAL_PHP-latest}-PR_NUMBER`, where `PR_NUMBER` is the number of the Pull Request you submitted.
24 changes: 17 additions & 7 deletions update.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@
'download_url' => 'https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar',
),
),
'8.0' => array(
'php' => array(
'base_name' => 'devilbox/php-fpm-8.0:latest',
'gd' => false,
'extensions' => array( 'mysqli' ),
'pecl_extensions' => array(),
),
'phpunit' => 7,
'cli' => array(
'mysql_client' => 'virtual-mysql-client',
'download_url' => 'https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar',
),
),
);

// A warning that will be added to each Dockerfile, to ensure folks don't edit them directly.
Expand All @@ -166,10 +179,7 @@
# install the PHP extensions we need
RUN set -ex; \
\
%%INSTALL_GD%%
%%EXTENSIONS%% \
\
%%PECL_EXTENSIONS%%
%%INSTALL_GD%%%%EXTENSIONS%%%%PECL_EXTENSIONS%%
EOT;

$install_gd = <<<EOT
Expand All @@ -181,7 +191,7 @@
libzip-dev \
; \
\
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr;
EOT;


Expand Down Expand Up @@ -234,7 +244,7 @@
}

if ( $config['extensions'] ) {
$extensions = 'docker-php-ext-install ' . implode( $config['extensions'], ' ' ) . ";";
$extensions = " \\\n\tdocker-php-ext-install " . implode( $config['extensions'], ' ' ) . ";";
$dockerfile = str_replace( '%%EXTENSIONS%%', $extensions, $dockerfile );
}

Expand All @@ -247,7 +257,7 @@
return "$command\tpecl install $extension;";
}, '' );

$dockerfile = str_replace( '%%PECL_EXTENSIONS%%', $pecl_extensions, $dockerfile );
$dockerfile = str_replace( '%%PECL_EXTENSIONS%%', " \\\n\t\\\n$pecl_extensions", $dockerfile );
}
} elseif ( $image === 'phpunit' ) {
// Replace tags inside the PHPUnit Dockerfile template.
Expand Down

0 comments on commit afb6aea

Please sign in to comment.