commit d2487b475bc3e00cc6301cf512b7525afecebc5d Author: Bojan Čekrlić Date: Fri Mar 18 00:06:12 2016 +0100 Postfix, initial release diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f6bf100 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM alpine:edge +MAINTAINER Bojan Cekrlic + +# You can set this variables when running the image to override the host name or +# foward the messages to another server +#ENV HOSTNAME +#ENV RELAYHOST + +RUN true && \ + apk add --no-cache --update postfix ca-certificates supervisor rsyslog bash && \ + (rm "/tmp/"* 2>/dev/null || true) && (rm -rf /var/cache/apk/* 2>/dev/null || true) + +COPY supervisord.conf /etc/supervisord.conf +COPY rsyslog.conf /etc/rsyslog.conf +COPY postfix.sh /postfix.sh +RUN chmod +x /postfix.sh + +VOLUME [ "/var/spool/postfix" ] + +USER root +WORKDIR /tmp +ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] + diff --git a/postfix.sh b/postfix.sh new file mode 100644 index 0000000..786b6ba --- /dev/null +++ b/postfix.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [[ ! -z "$HOSTNAME" ]]; then + postconf -e myhostname=$HOSTNAME +else + postconf -# myhostname +fi + +if [[ ! -z "$RELAYHOST" ]]; then + postconf -e relayhost=$RELAYHOST +else + postconf -# relayhost +fi + +/usr/sbin/postfix -c /etc/postfix start diff --git a/rsyslog.conf b/rsyslog.conf new file mode 100644 index 0000000..44ed1ad --- /dev/null +++ b/rsyslog.conf @@ -0,0 +1,14 @@ +$ModLoad immark.so # provides --MARK-- message capability +$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) + +# default permissions for all log files. +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +#*.info /dev/stdout +#mail.* /dev/stdout +mail.info /dev/stdout + diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..e9786c2 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,22 @@ +[supervisord] +nodaemon = true +logfile = /dev/null +logfile_maxbytes= 0 + +[program:rsyslog] +command = rsyslogd -n +autostart = true +autorestart = true +startsecs = 2 +stopwaitsecs = 2 +stdout_logfile = /dev/stdout +stderr_logfile = /dev/stderr +stdout_logfile_maxbytes = 0 +stderr_logfile_maxbytes = 0 + +[program:postfix] +process_name = master +directory = /etc/postfix +command = /postfix.sh +startsecs = 0 +autorestart = false