Basic docker container files

This commit is contained in:
Thomas Renger 2023-03-19 22:14:22 +01:00
parent 48003afd8a
commit 8e3a877a01
2 changed files with 97 additions and 0 deletions

19
Dockerfile Normal file
View File

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

78
start.sh Normal file
View File

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