From facd1597ac12b78f38c3fe0185790af5a68e7657 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Mon, 10 Apr 2023 13:13:36 +0300 Subject: [PATCH 1/2] feat(php-fpm): Add support for mailpit --- php-fpm/rootfs-common/usr/local/bin/run.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/php-fpm/rootfs-common/usr/local/bin/run.sh b/php-fpm/rootfs-common/usr/local/bin/run.sh index f79f038a..fab6bb3e 100755 --- a/php-fpm/rootfs-common/usr/local/bin/run.sh +++ b/php-fpm/rootfs-common/usr/local/bin/run.sh @@ -13,10 +13,13 @@ 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/sbin/sendmail -S mailpit:1025" > "${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 From c634ec36988c7e4ffb40b670803d29f378e7099f Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Tue, 11 Apr 2023 10:20:58 +0300 Subject: [PATCH 2/2] fix(php-fpm): Use msmtp to talk to mailpit --- php-fpm/Dockerfile.74 | 2 +- php-fpm/Dockerfile.80 | 2 +- php-fpm/Dockerfile.81 | 2 +- php-fpm/Dockerfile.82 | 2 +- php-fpm/rootfs-common/usr/local/bin/run.sh | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/php-fpm/Dockerfile.74 b/php-fpm/Dockerfile.74 index a25928c5..672fd848 100644 --- a/php-fpm/Dockerfile.74 +++ b/php-fpm/Dockerfile.74 @@ -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 \ diff --git a/php-fpm/Dockerfile.80 b/php-fpm/Dockerfile.80 index 40026808..787b856d 100644 --- a/php-fpm/Dockerfile.80 +++ b/php-fpm/Dockerfile.80 @@ -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 \ diff --git a/php-fpm/Dockerfile.81 b/php-fpm/Dockerfile.81 index ae0a5163..649bfc23 100644 --- a/php-fpm/Dockerfile.81 +++ b/php-fpm/Dockerfile.81 @@ -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 \ diff --git a/php-fpm/Dockerfile.82 b/php-fpm/Dockerfile.82 index f51b1fdd..66b430f6 100644 --- a/php-fpm/Dockerfile.82 +++ b/php-fpm/Dockerfile.82 @@ -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 \ diff --git a/php-fpm/rootfs-common/usr/local/bin/run.sh b/php-fpm/rootfs-common/usr/local/bin/run.sh index fab6bb3e..0189dc39 100755 --- a/php-fpm/rootfs-common/usr/local/bin/run.sh +++ b/php-fpm/rootfs-common/usr/local/bin/run.sh @@ -5,16 +5,16 @@ 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/sbin/sendmail -S mailpit:1025" > "${PHP_INI_DIR}/conf.d/99-mailpit.ini" + 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