commit 9421f5aea885f109a323dd2af1054425816f0d7c Author: Paul Date: Wed Aug 12 09:28:52 2020 +0200 Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..74755f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM debian:buster + +EXPOSE 25 465 587 + +RUN DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + postfix \ + postfix-ldap \ + rsyslog \ + supervisor \ + ca-certificates &&\ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ADD entrypoint.sh / +RUN chmod +x /entrypoint.sh + +ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +VOLUME /var/spool/postfix + +#ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["supervisord"] + diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..18c8950 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +CHROOTSERV=$(awk '/^[0-9a-z]/ && ($5 ~ "[-yY]") { print $1; exit}' /etc/postfix/master.cf) + +if [ -n "${CHROOTSERV}" ]; then + echo "The service $CHROOTSERV is configured to use chroot. Please change it in master.cf" >&2 + exit 1 +fi + +#Test config +echo -n "Checking configuration... " +postfix check || exit 2 +echo "OK" + +#Create aliases +echo -n "Creating new aliases..." +newaliases +echo "OK" + +exec /usr/lib/postfix/sbin/master -c /etc/postfix -d # 2>&1 + diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..1288c67 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,9 @@ +[supervisord] +nodaemon=true + +[program:rsyslog] +command=/usr/sbin/rsyslogd -n + +[program:postfix] +command=/entrypoint.sh +