-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CI): Adds GitHub Actions Multi-Platform Dev Container Builds
- Adds support for multiple-platform Dev Container builds using multiple runners. - Adds support for building multiple images with a list of supported PHP & NodeJS versions. - Replicates the `wordpressdevelop/php` Docker image build in order to support arm64.
- Loading branch information
Showing
16 changed files
with
2,465 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
ARG PHP_VERSION=8.3 | ||
|
||
FROM php:${PHP_VERSION}-fpm-bullseye | ||
|
||
LABEL org.opencontainers.image.url=https://github.com/ndigitals/wp-dev-container/pkgs/container/wp-dev-container | ||
LABEL org.opencontainers.image.documentation=https://github.com/ndigitals/wp-dev-container/wiki | ||
LABEL org.opencontainers.image.source=https://github.com/ndigitals/wp-dev-container | ||
LABEL org.opencontainers.image.vendor="Nolte Digital Solutions" | ||
LABEL org.opencontainers.image.licenses=MIT | ||
|
||
WORKDIR /var/www | ||
|
||
########################################################################## | ||
# | ||
# This setup is generally a direct copy from https://github.com/WordPress/wpdev-docker-images | ||
# | ||
|
||
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 --location --output /usr/local/bin/pickle https://github.com/FriendsOfPHP/pickle/releases/download/v0.7.11/pickle.phar; \ | ||
chmod +x /usr/local/bin/pickle; \ | ||
\ | ||
pickle install memcached-3.2.0; \ | ||
pickle install xdebug-3.2.1; \ | ||
pickle install imagick; \ | ||
docker-php-ext-enable imagick; \ | ||
\ | ||
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 --2 --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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// For format details, https://containers.dev/implementors/json_reference/. | ||
{ | ||
"build": { | ||
"dockerfile": "./Dockerfile", | ||
"context": ".", | ||
"args": { | ||
"PHP_VERSION": "${localEnv:PHP_VERSION}" | ||
} | ||
}, | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"username": "wp_php" | ||
}, | ||
"ghcr.io/devcontainers/features/node:1": { | ||
"version": "${localEnv:NODE_VERSION}" | ||
}, | ||
"ghcr.io/devcontainers/features/git:1": {}, | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"./local-features/wp-cli": "latest", | ||
"./local-features/php-cli-xdebug": "latest" | ||
}, | ||
|
||
"overrideFeatureInstallOrder": [ | ||
"ghcr.io/devcontainers/features/common-utils", | ||
"ghcr.io/devcontainers/features/node", | ||
"ghcr.io/devcontainers/features/docker-in-docker", | ||
"ghcr.io/devcontainers/features/git", | ||
"ghcr.io/devcontainers/features/github-cli", | ||
"./local-features/wp-cli", | ||
"./local-features/php-cli-xdebug" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
source /common.sh | ||
|
||
# Execute CMD | ||
exec "$@" |
8 changes: 8 additions & 0 deletions
8
.devcontainer/local-features/php-cli-xdebug/devcontainer-feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Id": "php-cli-xdebug", | ||
"name": "Configure PHP CLI w/ Xdebug", | ||
"install": { | ||
"app": "", | ||
"file": "install.sh" | ||
} | ||
} |
Oops, something went wrong.