Commit 1980e9e7 by Alex Eftimie

Initial commit. Setup a centos7 image with postfix

parents
FROM centos:centos7
ENV MTP_HOST=fwd.example.com
ENV MTP_PORT=25
ENV MTP_USER=user
ENV MTP_PASS=password
RUN yum -y install postfix mailx cyrus-sasl cyrus-sasl-plain python-setuptools python-pip
RUN curl https://bootstrap.pypa.io/get-pip.py | python -
RUN pip install supervisor
RUN mkdir -p /etc/supervisor.d/conf.d
RUN echo_supervisord_conf > /etc/supervisord.conf
RUN echo '[include]' >> /etc/supervisord.conf
RUN echo 'files = supervisor/conf.d/*.conf' >> /etc/supervisord.conf
RUN postconf -e "relayhost = [$MTP_HOST]:$MTP_PORT"
RUN postconf -e 'smtp_sasl_auth_enable = yes'
RUN postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd'
RUN postconf -e 'smtp_sasl_security_options = noanonymous'
RUN postconf -e 'smtp_tls_security_level = may'
RUN touch /var/log/mail.log
RUN mkdir -p /var/spool/postfix/public/
RUN mkfifo /var/spool/postfix/public/pickup
EXPOSE 25
VOLUME ["/var/log", "/var/spool/postfix"]
ADD postfix.sh /postfix.sh
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["sh", "-c", "/usr/bin/supervisord""]
\ No newline at end of file
#!/bin/bash
# Set up user
function setup_secret {
echo "$MTP_HOST $MTP_USER:$MTP_PASS" > /etc/postfix/relay_passwd
postmap /etc/postfix/relay_passwd
}
setup_secret
postfix start
tail -f /var/log/mail.log
[supervisord]
nodaemon=true
[program:postfix]
command=/postfix.sh
autostart=true
autorestart=true
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment