forked from davidepedranz/docker-send-only-postfix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
34 lines (28 loc) · 1.13 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env sh
set -e
# read domain from environment
if [ -z "${DOMAIN}" ]; then
echo "DOMAIN environment variable not found. Please set it before running this Docker container."
exit 1
fi
# read relay from environment
if [ -z "${RELAY}" ]; then
echo "RELAY environment variable not found. Please set it before running this Docker container."
exit 1
fi
# read relay from environment
if [ -z "${MYNETWORKS}" ]; then
echo "MYNETWORKS environment variable not found. Please set it before running this Docker container."
exit 1
fi
# replace the placeholders in the configuration files
PATTERN="s/\${DOMAIN}/${DOMAIN}/g"
sed -i ${PATTERN} /etc/postfix/main.cf
PATTERN="s/\${RELAY}/${RELAY}/g"
sed -i ${PATTERN} /etc/postfix/main.cf
PATTERN="s/\${MYNETWORKS}/${MYNETWORKS}/g"
sed -i ${PATTERN} /etc/postfix/main.cf
#We even listen on 1025 inside the container so UFW understands
sed -i 's/smtp inet n - y - - smtpd/1025 inet n - y - - smtpd/' /etc/postfix/master.cf
# launch the processes supervisor
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf