Commit 40487c49 by Alex Eftimie

Refactor: use centos6 image that can start the postfix service.

Add a separate folder for eionet specific config.
parent 14978526
MTP_USER=user
MTP_PASS=password
# If you are using the generic eeacms/postfix:latest, also set:
#MTP_HOST=subdomain.example.eu
#MTP_RELAY=relay.domain.tld
FROM centos:centos7
FROM layerworx/centos
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 rsyslog
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"]
VOLUME ["/var/log"]
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
CMD ["sh", "-c", "./postfix.sh"]
\ No newline at end of file
# eea.docker.postfix
Postfix image for Smtp relay authentication.
# Postfix Image for SMTP Auth
Build:
docker build -t eeacms/postfix .
Edit the `.secrets` with your smtp authentication.
Usage:
docker run --rm -t -i --env-file=.secret eeacms/postfix
FROM eeacms/postfix:latest
ENV MTP_HOST=docker.eionet.europa.eu
ENV MTP_RELAY=ironport1.eea.europa.eu
ENV MTP_PORT=8587
\ 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
function setup_conf_and_secret {
postconf -e "myhostname = $MTP_HOST"
postconf -e "relayhost = [$MTP_RELAY]:$MTP_PORT"
postconf -e 'smtp_sasl_auth_enable = yes'
postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd'
postconf -e 'smtp_sasl_security_options = noanonymous'
postconf -e 'smtp_tls_security_level = may'
postconf -e 'mynetworks = 127.0.0.0/8 172.17.0.0/16'
postconf -e 'inet_interfaces = all'
echo "$MTP_RELAY $MTP_USER:$MTP_PASS" > /etc/postfix/relay_passwd
postmap /etc/postfix/relay_passwd
}
setup_secret
setup_conf_and_secret
postfix start
service rsyslog start
service postfix start
tail -f /var/log/mail.log
touch /var/log/maillog
tail -f /var/log/maillog
[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