Minor edits for easier understanding.

The Dockerfile has been reformatted a bit to make it more clear and easy
to understand. README.md has been updated with the postfix's user
account details.
This commit is contained in:
Bojan Čekrlić 2018-07-27 16:42:35 +02:00
parent 50ad64dc4e
commit 0638d349bd
2 changed files with 35 additions and 13 deletions

View file

@ -3,21 +3,38 @@ MAINTAINER Bojan Cekrlic - https://github.com/bokysan/docker-postfix/
# See README.md for details
RUN true && \
apk add --no-cache --update postfix ca-certificates supervisor rsyslog bash && \
apk add --no-cache --upgrade musl musl-utils && \
(rm "/tmp/"* 2>/dev/null || true) && (rm -rf /var/cache/apk/* 2>/dev/null || true)
# Postfix myhostname
ENV HOSTNAME=
# Host that relays your msgs
ENV RELAYHOST=
# An (optional) username for the relay server
ENV RELAYHOST_USERNAME=
# An (optional) login password for the relay server
ENV RELAYHOST_PASSWORD=
# Allow domains from per Network ( default 127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 )
ENV MYNETWORKS=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
# Allow any sender domains
ENV ALLOWED_SENDER_DOMAINS=
COPY supervisord.conf /etc/supervisord.conf
COPY rsyslog.conf /etc/rsyslog.conf
COPY run.sh /run.sh
RUN chmod +x /run.sh
# Install supervisor, postfix and bash (because run.sh is not sh-complatible)
RUN true && \
apk add --no-cache --update postfix ca-certificates supervisor rsyslog bash && \
apk add --no-cache --upgrade musl musl-utils && \
(rm "/tmp/"* 2>/dev/null || true) && (rm -rf /var/cache/apk/* 2>/dev/null || true)
VOLUME [ "/var/spool/postfix", "/etc/postfix" ]
# Set up configuration
COPY supervisord.conf /etc/supervisord.conf
COPY rsyslog.conf /etc/rsyslog.conf
COPY run.sh /run.sh
RUN chmod +x /run.sh
USER root
WORKDIR /tmp
# Set up spool volume
VOLUME [ "/var/spool/postfix", "/etc/postfix" ]
EXPOSE 587
#ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
# Run supervisord
USER root
WORKDIR /tmp
EXPOSE 587
ENTRYPOINT ["/run.sh"]

View file

@ -119,3 +119,8 @@ ADD Dockerfiles/additiona-config.sh /docker-init.db/
```
Build it with docker and your script will be automatically executed before Postfix starts.
## Security
Postfix will run the master proces as `root`, because that's how it's designed. Subprocesses will run under the `postfix` account
which will use `UID:GID` of `100:101`.