mailcow dockerized
This commit is contained in:
30
data/Dockerfiles/postfix/Dockerfile
Normal file
30
data/Dockerfiles/postfix/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
From ubuntu:xenial
|
||||
MAINTAINER Andre Peters <andre.peters@servercow.de>
|
||||
|
||||
# Set noninteractive mode for apt-get
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# Update
|
||||
RUN apt-get update
|
||||
|
||||
# Start editing
|
||||
# Install package here for cache
|
||||
RUN apt-get -y install supervisor \
|
||||
postfix \
|
||||
sasl2-bin \
|
||||
postfix \
|
||||
postfix-mysql \
|
||||
postfix-pcre \
|
||||
rsyslog \
|
||||
ca-certificates
|
||||
|
||||
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
||||
COPY postfix.sh /opt/postfix.sh
|
||||
|
||||
RUN groupadd -g 5000 vmail
|
||||
RUN useradd -g vmail -u 5000 vmail -d /var/vmail
|
||||
|
||||
EXPOSE 588
|
||||
|
||||
# Run
|
||||
CMD /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
18
data/Dockerfiles/postfix/postfix.sh
Executable file
18
data/Dockerfiles/postfix/postfix.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# http://superuser.com/questions/168412/using-supervisord-to-control-the-postfix-mta
|
||||
|
||||
trap "postfix stop" SIGINT
|
||||
trap "postfix stop" SIGTERM
|
||||
trap "postfix reload" SIGHUP
|
||||
|
||||
# start postfix
|
||||
postfix -c /opt/postfix/conf start
|
||||
|
||||
# lets give postfix some time to start
|
||||
sleep 3
|
||||
|
||||
# wait until postfix is dead (triggered by trap)
|
||||
while kill -0 $(cat /var/spool/postfix/pid/master.pid); do
|
||||
sleep 5
|
||||
done
|
17
data/Dockerfiles/postfix/supervisord.conf
Normal file
17
data/Dockerfiles/postfix/supervisord.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:rsyslog]
|
||||
command=/usr/sbin/rsyslogd -n
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
|
||||
[program:postfix]
|
||||
command=/opt/postfix.sh
|
||||
autorestart=true
|
||||
|
||||
[program:postfix-maillog]
|
||||
command=/usr/bin/tail -f /var/log/mail.log
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
Reference in New Issue
Block a user