-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
211 additions
and
6 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
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
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,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" ] |
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,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 "$@" |
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,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" ] |
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,7 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
source /common.sh | ||
|
||
# Execute CMD | ||
exec "$@" |
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,3 @@ | ||
[www] | ||
user = wp_php | ||
group = wp_php |
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,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 |
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,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 "$@" |
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