Optional SMTP relay
This commit is contained in:
parent
349feac543
commit
5f2697c0c9
@ -26,3 +26,9 @@ export DB_PASSWORD_VERSION=v1
|
||||
|
||||
# Backups
|
||||
#export COMPOSE_FILE="compose.yml:compose.backup.yml"
|
||||
|
||||
# SMTP
|
||||
#export COMPOSE_FILE="compose.yml:compose.mailrelay.yml"
|
||||
#export SMTP_HOST="postfix_relay_app"
|
||||
#export MSMTP_CONF_VERSION=v1
|
||||
#export ENTRYPOINT_MAILRELAY_CONF_VERSION=v1
|
||||
|
31
compose.mailrelay.yml
Normal file
31
compose.mailrelay.yml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
wordpress:
|
||||
entrypoint: /docker-entrypoint2.sh
|
||||
environment:
|
||||
- SMTP_HOST=${SMTP_HOST}
|
||||
networks:
|
||||
- mail
|
||||
configs:
|
||||
- source: entrypoint_mailrelay_conf
|
||||
target: /docker-entrypoint2.sh
|
||||
mode: 0555
|
||||
- source: mstmp_conf
|
||||
target: /etc/msmtprc
|
||||
mode: 0555
|
||||
|
||||
networks:
|
||||
mail:
|
||||
external: true
|
||||
|
||||
configs:
|
||||
mstmp_conf:
|
||||
name: ${STACK_NAME}_mstmp_conf_${MSMTP_CONF_VERSION}
|
||||
file: msmtp.conf.tmpl
|
||||
template_driver: golang
|
||||
entrypoint_mailrelay_conf:
|
||||
name: ${STACK_NAME}_entrypoint_mailrelay_${ENTRYPOINT_MAILRELAY_CONF_VERSION}
|
||||
file: entrypoint.mailrelay.sh.tmpl
|
||||
template_driver: golang
|
9
entrypoint.mailrelay.sh.tmpl
Normal file
9
entrypoint.mailrelay.sh.tmpl
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y msmtp && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
echo "sendmail_path = /usr/bin/msmtp -t -i" >> /usr/local/etc/php/conf.d/sendmail.ini
|
||||
|
||||
# Upstream ENTRYPOINT
|
||||
# https://github.com/docker-library/wordpress/blob/master/php7.4/apache/Dockerfile#L120
|
||||
/usr/local/bin/docker-entrypoint.sh apache2-foreground "$@"
|
3
msmtp.conf.tmpl
Normal file
3
msmtp.conf.tmpl
Normal file
@ -0,0 +1,3 @@
|
||||
account default
|
||||
host {{ env "SMTP_HOST" }}
|
||||
auto_from on
|
Loading…
Reference in New Issue
Block a user