Skip to content

Commit

Permalink
Merge pull request #464 from Automattic/add/mailpit
Browse files Browse the repository at this point in the history
feat(php-fpm): Add support for mailpit
  • Loading branch information
sjinks authored Apr 11, 2023
2 parents cfaef93 + c634ec3 commit b92f6bc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion php-fpm/Dockerfile.74
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:3.15@sha256:cf34c62ee8eb3fe8aa24c1fab45d7e9d12768d945c3f5a6fd6a63d901e898479

RUN \
apk add --no-cache ca-certificates curl tar xz openssl less bash mariadb-client su-exec shadow git jq ghostscript php7 php7-fpm php7-pear \
apk add --no-cache ca-certificates curl tar xz openssl less bash mariadb-client su-exec shadow git jq ghostscript msmtp php7 php7-fpm php7-pear \
php7-pecl-apcu \
php7-bcmath \
php7-calendar \
Expand Down
2 changes: 1 addition & 1 deletion php-fpm/Dockerfile.80
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM alpine:3.16.3@sha256:b95359c2505145f16c6aa384f9cc74eeff78eb36d308ca4fd902ee

RUN \
echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk add --no-cache ca-certificates curl tar xz openssl less bash mariadb-client su-exec shadow git jq icu-data-full ghostscript php8 php8-fpm php8-pear \
apk add --no-cache ca-certificates curl tar xz openssl less bash mariadb-client su-exec shadow git jq icu-data-full ghostscript msmtp php8 php8-fpm php8-pear \
php8-pecl-apcu \
php8-bcmath \
php8-calendar \
Expand Down
2 changes: 1 addition & 1 deletion php-fpm/Dockerfile.81
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN pecl81 install channel://pecl.php.net/gmagick-2.0.6RC1 < /dev/null
FROM alpine:3.17.0@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4

RUN \
apk add --no-cache ca-certificates curl tar xz openssl less bash mariadb-client su-exec shadow git jq icu-data-full ghostscript php81 php81-fpm php81-pear \
apk add --no-cache ca-certificates curl tar xz openssl less bash mariadb-client su-exec shadow git jq icu-data-full ghostscript msmtp php81 php81-fpm php81-pear \
graphicsmagick libgomp \
php81-pecl-apcu \
php81-bcmath \
Expand Down
2 changes: 1 addition & 1 deletion php-fpm/Dockerfile.82
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM alpine:edge

RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN \
apk add --no-cache ca-certificates curl tar xz openssl less bash mariadb-client su-exec shadow git jq icu-data-full ghostscript php82 php82-fpm php82-pear \
apk add --no-cache ca-certificates curl tar xz openssl less bash mariadb-client su-exec shadow git jq icu-data-full ghostscript msmtp php82 php82-fpm php82-pear \
graphicsmagick libgomp \
php82-pecl-apcu \
php82-bcmath \
Expand Down
7 changes: 5 additions & 2 deletions php-fpm/rootfs-common/usr/local/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ XDEBUG_CONFIG_TARGET_LOCATION="${PHP_INI_DIR}/conf.d/docker-php-ext-xdebug.ini"

if [ "enable" = "$XDEBUG" ]; then
echo "Enabling XDebug"
cp $XDEBUG_CONFIG_TEMPLATE_LOCATION $XDEBUG_CONFIG_TARGET_LOCATION
cp "$XDEBUG_CONFIG_TEMPLATE_LOCATION" "$XDEBUG_CONFIG_TARGET_LOCATION"
else
echo "Disabling XDebug"
rm -f $XDEBUG_CONFIG_TARGET_LOCATION
rm -f "$XDEBUG_CONFIG_TARGET_LOCATION"
fi

if [ -n "${LANDO_INFO}" ] && [ 'null' != "$(echo "${LANDO_INFO}" | jq -r .mailhog)" ]; then
echo "sendmail_path = /usr/sbin/sendmail -S $(echo "${LANDO_INFO}" | jq -r '.mailhog.internal_connection.host + ":" + .mailhog.internal_connection.port')" > "${PHP_INI_DIR}/conf.d/99-mailhog.ini"
elif [ -n "${LANDO_INFO}" ] && [ 'null' != "$(echo "${LANDO_INFO}" | jq -r .mailpit)" ]; then
echo "sendmail_path = /usr/bin/msmtp --host=mailpit --port=1025 -t --auto-from" > "${PHP_INI_DIR}/conf.d/99-mailpit.ini"
elif [ -n "${ENABLE_MAILHOG}" ]; then
echo "sendmail_path = /usr/sbin/sendmail -S mailhog:1025" > "${PHP_INI_DIR}/conf.d/99-mailhog.ini"
else
rm -f "${PHP_INI_DIR}/conf.d/99-mailhog.ini"
rm -f "${PHP_INI_DIR}/conf.d/99-mailpit.ini"
fi

exec /usr/sbin/php-fpm

0 comments on commit b92f6bc

Please sign in to comment.