FROM debian:stable-slim # Install Postfix and tools RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ postfix \ postfix-mysql \ libsasl2-modules \ mailutils \ gettext-base \ netcat-openbsd \ python3 \ python3-pymysql \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Copy configs COPY main.cf.template /etc/postfix/main.cf.template COPY sasl_passwd.template /etc/postfix/sasl_passwd.template COPY mysql_virtual_alias_maps.cf /etc/postfix/mysql_virtual_alias_maps.cf.template COPY sender_access /etc/postfix/sender_access COPY smtp_generic /etc/postfix/smtp_generic COPY aliases /etc/aliases COPY process-bounce.py /usr/local/bin/process-bounce.py COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh /usr/local/bin/process-bounce.py # Generate Postfix maps for sender access, sender canonical, and aliases RUN postmap /etc/postfix/sender_access && \ postmap /etc/postfix/smtp_generic && \ newaliases # Expose SMTP EXPOSE 25 ENTRYPOINT ["/entrypoint.sh"]