FROM debian:bookworm-slim # install oostfix and OpenDKIM RUN apt-get update && apt-get install -y \ postfix \ opendkim \ opendkim-tools \ mailutils \ ca-certificates \ netcat-openbsd \ && rm -rf /var/lib/apt/lists/* # create OpenDKIM paths RUN mkdir -p /etc/opendkim/keys && \ chown -R opendkim:opendkim /etc/opendkim && \ chmod 700 /etc/opendkim/keys # copy config COPY postfix-main.cf /etc/postfix/main.cf COPY opendkim.conf /etc/opendkim.conf COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh EXPOSE 25 HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD echo "QUIT" | nc -w 5 localhost 25 | grep -q "220" || exit 1 ENTRYPOINT ["/entrypoint.sh"]