Browse Source

first commit

master
Andrey Arapov 4 years ago
parent
commit
463a1876aa
5 changed files with 60 additions and 0 deletions
  1. +18
    -0
      Dockerfile
  2. +16
    -0
      service/postfix/run
  3. +3
    -0
      service/rsyslogd/log/run
  4. +3
    -0
      service/rsyslogd/run
  5. +20
    -0
      start.sh

+ 18
- 0
Dockerfile 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
- 0
service/postfix/run 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
- 0
service/rsyslogd/log/run View File

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

+ 3
- 0
service/rsyslogd/run View File

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

+ 20
- 0
start.sh 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

Loading…
Cancel
Save