From 8e3a877a01d937ed25b7d725186651290e39ba52 Mon Sep 17 00:00:00 2001 From: Thomas Renger Date: Sun, 19 Mar 2023 22:14:22 +0100 Subject: [PATCH] Basic docker container files --- Dockerfile | 19 +++++++++++++ start.sh | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 Dockerfile create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..da84bf1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:22.04 + +ENV DEBIAN_FRONTEND=noninteractive \ + POSTFIX_OPTS="" + +COPY start.sh /start.sh +RUN apt-get update \ + && apt-get dist-upgrade -y \ + && apt-get install -y --no-install-recommends \ + postfix \ + swaks \ + prometheus-postfix-exporter \ + && rm -rf /var/lib/apt/lists/* \ + && chmod +x /start.sh + +EXPOSE 25 +EXPOSE 587 + +CMD ["sh", "/start.sh"] diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..9438170 --- /dev/null +++ b/start.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +set -e + +mkdir -p /var/spool/postfix +chown root:root /var/spool/postfix/ +chmod 0755 /var/spool/postfix + +mkdir -p \ + /var/spool/postfix/active \ + /var/spool/postfix/bounce \ + /var/spool/postfix/corrupt \ + /var/spool/postfix/defer \ + /var/spool/postfix/deferred \ + /var/spool/postfix/dev \ + /var/spool/postfix/etc \ + /var/spool/postfix/flush \ + /var/spool/postfix/incoming \ + /var/spool/postfix/lib \ + /var/spool/postfix/maildrop \ + /var/spool/postfix/pid \ + /var/spool/postfix/private \ + /var/spool/postfix/public \ + /var/spool/postfix/saved \ + /var/spool/postfix/usr \ + /var/spool/postfix/hold \ + /var/spool/postfix/trace + + +chmod 00700 /var/spool/postfix/active +chmod 00700 /var/spool/postfix/bounce +chmod 00700 /var/spool/postfix/corrupt +chmod 00700 /var/spool/postfix/defer +chmod 00700 /var/spool/postfix/deferred +chmod 00755 /var/spool/postfix/dev +chmod 00755 /var/spool/postfix/etc +chmod 00700 /var/spool/postfix/flush +chmod 00700 /var/spool/postfix/incoming +chmod 00755 /var/spool/postfix/lib +chmod 01730 /var/spool/postfix/maildrop +chmod 00755 /var/spool/postfix/pid +chmod 00700 /var/spool/postfix/private +chmod 02710 /var/spool/postfix/public +chmod 00700 /var/spool/postfix/saved +chmod 00755 /var/spool/postfix/usr + +chown -R postfix:postdrop \ + /var/spool/postfix/maildrop \ + /var/spool/postfix/public + +chown -R postfix:root \ + /var/spool/postfix/active \ + /var/spool/postfix/bounce \ + /var/spool/postfix/corrupt \ + /var/spool/postfix/defer \ + /var/spool/postfix/deferred \ + /var/spool/postfix/flush \ + /var/spool/postfix/hold \ + /var/spool/postfix/incoming \ + /var/spool/postfix/private \ + /var/spool/postfix/saved \ + /var/spool/postfix/trace + +chown root:root \ + /var/spool/postfix/dev \ + /var/spool/postfix/etc \ + /var/spool/postfix/lib \ + /var/spool/postfix/pid \ + /var/spool/postfix/usr + +cp /etc/host.conf \ + /etc/hosts \ + /etc/nsswitch.conf \ + /etc/resolv.conf \ + /etc/services \ + /var/spool/postfix/etc + +exec postfix start-fg $POSTFIX_OPTS