first commit

This commit is contained in:
Andy 2016-06-19 23:55:47 +02:00
parent e87f690566
commit 463a1876aa
5 changed files with 60 additions and 0 deletions

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM alpine:3.4
MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
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

16
service/postfix/run Executable file
View File

@ -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

3
service/rsyslogd/log/run Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
touch /var/log/maillog
exec tail -f /var/log/maillog 2>&1

3
service/rsyslogd/run Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
touch /var/log/maillog
exec /usr/sbin/rsyslogd -n 2>&1

20
start.sh Executable file
View File

@ -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