2018-11-13 19:05:58 +08:00
|
|
|
FROM alpine:latest
|
2019-02-19 17:49:55 +08:00
|
|
|
LABEL maintaner="Bojan Cekrlic - https://github.com/bokysan/docker-postfix/"
|
2016-03-18 07:06:12 +08:00
|
|
|
|
2017-11-02 21:16:52 +08:00
|
|
|
# See README.md for details
|
2016-03-18 07:06:12 +08:00
|
|
|
|
2019-01-02 17:10:17 +08:00
|
|
|
# Set the timezone for the container, if needed.
|
|
|
|
ENV TZ=
|
2018-07-27 22:42:35 +08:00
|
|
|
# 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=
|
2019-01-02 17:10:17 +08:00
|
|
|
# Define relay host TLS connection level. See http://www.postfix.org/postconf.5.html#smtp_tls_security_level for details.
|
|
|
|
# By default, the permissive level ("may") is used, if not defined.
|
|
|
|
ENV RELAYHOST_TLS_LEVEL=
|
2018-07-27 22:42:35 +08:00
|
|
|
# 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=
|
2019-01-02 17:10:17 +08:00
|
|
|
# Attachments size. 0 means unlimited. Usually needs to be set if your relay host has an attachment size limit
|
|
|
|
ENV MESSAGE_SIZE_LIMIT=
|
|
|
|
# Enable additional debugging for connections to postfix
|
|
|
|
ENV INBOUND_DEBUGGING=
|
2016-03-18 07:06:12 +08:00
|
|
|
|
2019-01-02 17:10:17 +08:00
|
|
|
# Install supervisor, postfix
|
2019-02-19 19:08:13 +08:00
|
|
|
# Install postfix first to get the first account (101)
|
|
|
|
# Install opendkim second to get the second account (102)
|
2018-07-27 22:42:35 +08:00
|
|
|
RUN true && \
|
2019-05-13 19:28:55 +08:00
|
|
|
apk add --no-cache --upgrade cyrus-sasl cyrus-sasl-plain cyrus-sasl-login && \
|
|
|
|
apk add --no-cache postfix && \
|
2019-02-19 19:08:13 +08:00
|
|
|
apk add --no-cache opendkim && \
|
|
|
|
apk add --no-cache ca-certificates tzdata supervisor rsyslog && \
|
2018-07-27 22:42:35 +08:00
|
|
|
apk add --no-cache --upgrade musl musl-utils && \
|
|
|
|
(rm "/tmp/"* 2>/dev/null || true) && (rm -rf /var/cache/apk/* 2>/dev/null || true)
|
2016-03-18 07:06:12 +08:00
|
|
|
|
2018-07-27 22:42:35 +08:00
|
|
|
# Set up configuration
|
|
|
|
COPY supervisord.conf /etc/supervisord.conf
|
|
|
|
COPY rsyslog.conf /etc/rsyslog.conf
|
2019-02-19 17:49:55 +08:00
|
|
|
COPY opendkim.conf /etc/opendkim/opendkim.conf
|
2019-10-03 15:01:53 +08:00
|
|
|
COPY header_checks /etc/header_checks
|
2018-07-27 22:42:35 +08:00
|
|
|
COPY run.sh /run.sh
|
2019-02-19 17:49:55 +08:00
|
|
|
COPY opendkim.sh /opendkim.sh
|
|
|
|
RUN chmod +x /run.sh /opendkim.sh
|
2016-03-18 07:06:12 +08:00
|
|
|
|
2019-02-19 17:49:55 +08:00
|
|
|
# Set up volumes
|
|
|
|
VOLUME [ "/var/spool/postfix", "/etc/postfix", "/etc/opendkim/keys" ]
|
2016-03-18 07:06:12 +08:00
|
|
|
|
2018-07-27 22:42:35 +08:00
|
|
|
# Run supervisord
|
|
|
|
USER root
|
|
|
|
WORKDIR /tmp
|
|
|
|
|
|
|
|
EXPOSE 587
|
2019-02-19 17:49:55 +08:00
|
|
|
CMD ["/bin/sh", "-c", "/run.sh"]
|