2020-02-01 04:01:29 +08:00
|
|
|
ARG ALPINE_VERSION=latest
|
|
|
|
FROM alpine:${ALPINE_VERSION}
|
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
|
|
|
|
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 && \
|
2020-07-03 13:08:27 +08:00
|
|
|
apk add --no-cache --upgrade ca-certificates tzdata supervisor rsyslog musl musl-utils bash opendkim-utils && \
|
2018-07-27 22:42:35 +08:00
|
|
|
(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
|
2020-06-30 00:49:52 +08:00
|
|
|
COPY /configs/supervisord.conf /etc/supervisord.conf
|
2020-07-01 19:50:08 +08:00
|
|
|
COPY /configs/rsyslog*.conf /etc/
|
2020-06-30 00:49:52 +08:00
|
|
|
COPY /configs/opendkim.conf /etc/opendkim/opendkim.conf
|
|
|
|
COPY /configs/smtp_header_checks /etc/postfix/smtp_header_checks
|
|
|
|
COPY /scripts/*.sh /
|
|
|
|
|
2019-02-19 17:49:55 +08:00
|
|
|
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
|
|
|
|
|
2020-11-03 18:51:51 +08:00
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 CMD printf "EHLO healthcheck\n" | nc localhost 587 | grep -qE "^220.*ESMTP Postfix"
|
|
|
|
|
2018-07-27 22:42:35 +08:00
|
|
|
EXPOSE 587
|
2020-11-03 18:51:51 +08:00
|
|
|
CMD [ "/bin/sh", "-c", "/run.sh" ]
|