From 463a1876aabb9441f6edfc0a417c8decb34dd2a3 Mon Sep 17 00:00:00 2001 From: Andrey Arapov Date: Sun, 19 Jun 2016 23:55:47 +0200 Subject: [PATCH] first commit --- Dockerfile | 18 ++++++++++++++++++ service/postfix/run | 16 ++++++++++++++++ service/rsyslogd/log/run | 3 +++ service/rsyslogd/run | 3 +++ start.sh | 20 ++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 Dockerfile create mode 100755 service/postfix/run create mode 100755 service/rsyslogd/log/run create mode 100755 service/rsyslogd/run create mode 100755 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..399a5d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM alpine:3.4 +MAINTAINER Andrey Arapov + +RUN echo '@testing http://nl.alpinelinux.org/alpine/edge/testing' |tee -a /etc/apk/repositories && \ + apk update && \ + apk upgrade && \ + apk add tzdata rsyslog postfix runit@testing + +# tzdata - so that TZ environment variable gets processed +# rsyslog - to log postfix service into /var/log/maillog file + +# Not in use currently: +# - ca-certificates +# - coreutils +# - bind-tools + +COPY service /etc/service/ +ENTRYPOINT runsvdir -P /etc/service diff --git a/service/postfix/run b/service/postfix/run new file mode 100755 index 0000000..2830a3a --- /dev/null +++ b/service/postfix/run @@ -0,0 +1,16 @@ +#!/bin/sh + +# WORKAROUND: +# postfix has to be aware of the DNS servers +# without this workaround it uses 127.0.0.1:53 for some unknown (yet) reason... +mkdir -v /var/spool/postfix/etc +cp -v /etc/resolv.conf /var/spool/postfix/etc + +command_directory=$(postconf -h command_directory) +daemon_directory=$($command_directory/postconf -h daemon_directory) + +# make consistency check +$command_directory/postfix check 2>&1 + +# run Postfix +exec $daemon_directory/master 2>&1 diff --git a/service/rsyslogd/log/run b/service/rsyslogd/log/run new file mode 100755 index 0000000..0d7223d --- /dev/null +++ b/service/rsyslogd/log/run @@ -0,0 +1,3 @@ +#!/bin/sh +touch /var/log/maillog +exec tail -f /var/log/maillog 2>&1 diff --git a/service/rsyslogd/run b/service/rsyslogd/run new file mode 100755 index 0000000..6387ba9 --- /dev/null +++ b/service/rsyslogd/run @@ -0,0 +1,3 @@ +#!/bin/sh +touch /var/log/maillog +exec /usr/sbin/rsyslogd -n 2>&1 diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..70be3b0 --- /dev/null +++ b/start.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +PROJ=mail +APP=${PWD##*/} +TZ=Europe/Prague + +sudo docker build -t $PROJ/$APP . +sudo docker rm -f $APP +sudo docker run -d \ + --restart=always \ + -h $(hostname -f) \ + --name $APP \ + --net bridge \ + -p "25:25/tcp" \ + -p "587:587/tcp" \ + -e TZ=$TZ \ + -v $PWD/letsencrypt:/etc/letsencrypt:ro \ + -v $PWD/postfix/main.cf:/etc/postfix/main.cf:ro \ + -v $PWD/postfix/master.cf:/etc/postfix/master.cf:ro \ + $PROJ/$APP