diff --git a/pkg/postfix/Dockerfile b/pkg/postfix/Dockerfile index bb9653f..a0bb594 100644 --- a/pkg/postfix/Dockerfile +++ b/pkg/postfix/Dockerfile @@ -1,10 +1,15 @@ -FROM alpine:3.7 +FROM alpine MAINTAINER Pierre-Olivier Mercier -RUN apk add --no-cache postfix +RUN apk add --no-cache bash postfix EXPOSE 25 -CMD ["/usr/sbin/postfix", "-d"] +ENV POSTFIX_maillog_file=/dev/stdout + +COPY docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["/usr/sbin/postfix", "start-fg"] LABEL org.mobyproject.config='{"binds": ["/etc/resolv.conf:/etc/resolv.conf"], "capabilities": ["CAP_NET_BIND_SERVICE"]}' diff --git a/pkg/postfix/docker-entrypoint.sh b/pkg/postfix/docker-entrypoint.sh index 7db45e9..36b58a6 100755 --- a/pkg/postfix/docker-entrypoint.sh +++ b/pkg/postfix/docker-entrypoint.sh @@ -1,13 +1,7 @@ -#!/bin/sh +#!/bin/bash -set -e - -if [ `which unbound-$1 2>/dev/null` ]; then - set -- unbound-"$@" -elif [ ! `which $1 2>/dev/null` ]; then - set -- unbound -dv "$@" -fi - -unbound-anchor +# POSTFIX_var env -> postconf -e var=$POSTFIX_var +for e in ${!POSTFIX_*} ; do postconf -e "${e:8}=${!e}" ; done +chown -R postfix:postfix /var/lib/postfix /var/mail /var/spool/postfix exec "$@"