Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

PHP 7.4, 8.0 and 8.1 #27

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
38 changes: 38 additions & 0 deletions phpfpm/7.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM johnpbloch/phpfpm:7.4

RUN curl -L https://phar.phpunit.de/phpunit-8.phar > /tmp/phpunit.phar \
&& chmod +x /tmp/phpunit.phar \
&& mv /tmp/phpunit.phar /usr/local/bin/phpunit

RUN apt-get update && apt-get install -y \
git \
subversion \
wget \
libxml2-dev \
ssmtp \
imagemagick \
libmagickwand-dev \
unzip \
iproute2 \
libicu-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install soap intl \
&& echo "mailhub=mailcatcher:1025\nUseTLS=NO\nFromLineOverride=YES" > /etc/ssmtp/ssmtp.conf \
&& apt-get remove -y libmagickwand-dev libxml2-dev libicu-dev \
&& apt-get autoremove -y \
&& apt-get clean \
&& mkdir /var/www/.wp-cli \
&& chown www-data:www-data /var/www/.wp-cli

RUN XDEBUG=$(find /usr/local/lib/php -name 'xdebug.so' | head -n 1 | tail -n 1) \
&& ln -s $XDEBUG /usr/local/lib/php/extensions/xdebug.so

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

EXPOSE 9000
31 changes: 31 additions & 0 deletions phpfpm/7.4/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Ensure we have the host.docker.internal hostname available to linux as well
function fix_linux_internal_host() {
DOCKER_INTERNAL_HOST="host.docker.internal"

if ! grep $DOCKER_INTERNAL_HOST /etc/hosts > /dev/null ; then
DOCKER_INTERNAL_IP=`/sbin/ip route|awk '/default/ { print $3 }'`
echo -e "$DOCKER_INTERNAL_IP\t$DOCKER_INTERNAL_HOST" | tee -a /etc/hosts > /dev/null
echo 'Added $DOCKER_INTERNAL_HOST to hosts /etc/hosts'
fi
}

echo "Checking USER ID"
www_uid=`stat -c "%u" /var/www/html`
www_gid=`stat -c "%g" /var/www/html`

echo "Host user is $www_uid:$www_gid"

if [ ! $www_uid -eq 0 ]; then
echo "Updating www-data user and group to match host IDs"
usermod -u $www_uid www-data
groupmod -g $www_gid www-data

fix_linux_internal_host
fi

mkdir -p /var/www/.wp-cli/cache
chown www-data:www-data /var/www/.wp-cli/cache

exec "$@"
38 changes: 38 additions & 0 deletions phpfpm/8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM johnpbloch/phpfpm:8.0

RUN curl -L https://phar.phpunit.de/phpunit-8.phar > /tmp/phpunit.phar \
&& chmod +x /tmp/phpunit.phar \
&& mv /tmp/phpunit.phar /usr/local/bin/phpunit

RUN apt-get update && apt-get install -y \
git \
subversion \
wget \
libxml2-dev \
ssmtp \
imagemagick \
libmagickwand-dev \
unzip \
iproute2 \
libicu-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install soap intl \
&& echo "mailhub=mailcatcher:1025\nUseTLS=NO\nFromLineOverride=YES" > /etc/ssmtp/ssmtp.conf \
&& apt-get remove -y libmagickwand-dev libxml2-dev libicu-dev \
&& apt-get autoremove -y \
&& apt-get clean \
&& mkdir /var/www/.wp-cli \
&& chown www-data:www-data /var/www/.wp-cli

RUN XDEBUG=$(find /usr/local/lib/php -name 'xdebug.so' | head -n 1 | tail -n 1) \
&& ln -s $XDEBUG /usr/local/lib/php/extensions/xdebug.so

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

EXPOSE 9000
31 changes: 31 additions & 0 deletions phpfpm/8.0/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Ensure we have the host.docker.internal hostname available to linux as well
function fix_linux_internal_host() {
DOCKER_INTERNAL_HOST="host.docker.internal"

if ! grep $DOCKER_INTERNAL_HOST /etc/hosts > /dev/null ; then
DOCKER_INTERNAL_IP=`/sbin/ip route|awk '/default/ { print $3 }'`
echo -e "$DOCKER_INTERNAL_IP\t$DOCKER_INTERNAL_HOST" | tee -a /etc/hosts > /dev/null
echo 'Added $DOCKER_INTERNAL_HOST to hosts /etc/hosts'
fi
}

echo "Checking USER ID"
www_uid=`stat -c "%u" /var/www/html`
www_gid=`stat -c "%g" /var/www/html`

echo "Host user is $www_uid:$www_gid"

if [ ! $www_uid -eq 0 ]; then
echo "Updating www-data user and group to match host IDs"
usermod -u $www_uid www-data
groupmod -g $www_gid www-data

fix_linux_internal_host
fi

mkdir -p /var/www/.wp-cli/cache
chown www-data:www-data /var/www/.wp-cli/cache

exec "$@"
38 changes: 38 additions & 0 deletions phpfpm/8.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM johnpbloch/phpfpm:8.1

RUN curl -L https://phar.phpunit.de/phpunit-8.phar > /tmp/phpunit.phar \
&& chmod +x /tmp/phpunit.phar \
&& mv /tmp/phpunit.phar /usr/local/bin/phpunit

RUN apt-get update && apt-get install -y \
git \
subversion \
wget \
libxml2-dev \
ssmtp \
imagemagick \
libmagickwand-dev \
unzip \
iproute2 \
libicu-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install soap intl \
&& echo "mailhub=mailcatcher:1025\nUseTLS=NO\nFromLineOverride=YES" > /etc/ssmtp/ssmtp.conf \
&& apt-get remove -y libmagickwand-dev libxml2-dev libicu-dev \
&& apt-get autoremove -y \
&& apt-get clean \
&& mkdir /var/www/.wp-cli \
&& chown www-data:www-data /var/www/.wp-cli

RUN XDEBUG=$(find /usr/local/lib/php -name 'xdebug.so' | head -n 1 | tail -n 1) \
&& ln -s $XDEBUG /usr/local/lib/php/extensions/xdebug.so

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

EXPOSE 9000
31 changes: 31 additions & 0 deletions phpfpm/8.1/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Ensure we have the host.docker.internal hostname available to linux as well
function fix_linux_internal_host() {
DOCKER_INTERNAL_HOST="host.docker.internal"

if ! grep $DOCKER_INTERNAL_HOST /etc/hosts > /dev/null ; then
DOCKER_INTERNAL_IP=`/sbin/ip route|awk '/default/ { print $3 }'`
echo -e "$DOCKER_INTERNAL_IP\t$DOCKER_INTERNAL_HOST" | tee -a /etc/hosts > /dev/null
echo 'Added $DOCKER_INTERNAL_HOST to hosts /etc/hosts'
fi
}

echo "Checking USER ID"
www_uid=`stat -c "%u" /var/www/html`
www_gid=`stat -c "%g" /var/www/html`

echo "Host user is $www_uid:$www_gid"

if [ ! $www_uid -eq 0 ]; then
echo "Updating www-data user and group to match host IDs"
usermod -u $www_uid www-data
groupmod -g $www_gid www-data

fix_linux_internal_host
fi

mkdir -p /var/www/.wp-cli/cache
chown www-data:www-data /var/www/.wp-cli/cache

exec "$@"