39 lines
1.6 KiB
Docker
39 lines
1.6 KiB
Docker
# NAME leenooks/smtp
|
|
# VERSION latest
|
|
|
|
FROM alpine
|
|
|
|
# Change to http respositories, so they we can cache the install packages
|
|
RUN if [ -n ${HTTP_PROXY} ] ; then sed -ie s'/https/http/' /etc/apk/repositories; fi
|
|
|
|
RUN apk add shadow && useradd -rc "HUB Mail Relay" -M relay -NG mail -s /sbin/nologin && echo relay:SmTpR3l2Y | chpasswd
|
|
|
|
RUN apk add --no-cache postfix opendkim opendkim-utils \
|
|
&& gpasswd -a postfix opendkim
|
|
|
|
# Config postfix
|
|
RUN sed -ie 's%#mynetworks = hash:/etc/postfix/network_table%mynetworks = /etc/opendkim/signing/TrustedHosts%' /etc/postfix/main.cf \
|
|
&& echo -n 'bWVzc2FnZV9zaXplX2xpbWl0ID0gMjU2MDAwMDAKcXVldWVfbWluZnJlZSA9IDUxMjAwMDAwCg=='|base64 -d >> /etc/postfix/main.cf
|
|
|
|
# Enable DKIM
|
|
RUN mkdir /run/opendkim \
|
|
&& echo -n 'IyBNaWx0ZXIgY29uZmlndXJhdGlvbiAtIG9wZW5ka2ltCiMgSWYgdGhlIE9wZW5ES0lNIG1pbHRl\
|
|
ciBpc24ndCBhdmFpbGFibGUsIGFjY2VwdCB0aGUgbWVzc2FnZSBhbnl3YXkuCm1pbHRlcl9kZWZh\
|
|
dWx0X2FjdGlvbiA9IGFjY2VwdAojIFdoYXQgbWlsdGVyIGNvbW11bmljYXRpb24gcHJvdG9jb2wg\
|
|
c2hvdWxkIGJlIHVzZWQgdG8gcGFzcyBtZXNzYWdlcwojIHRvIGFuZCBmcm9tIE9wZW5ES0lNPwpt\
|
|
aWx0ZXJfcHJvdG9jb2wgPSA2CiMgV2hlcmUgc2hvdWxkIHRoZSBPcGVuREtJTSBtaWx0ZXIgYmUg\
|
|
Y29udGFjdCB0aHJvdWdoPyAgTm90ZSB0aGF0IHRoaXMKIyBpcyBpbnNpZGUgdGhlIC92YXIvc3Bv\
|
|
b2wvcG9zdGZpeCBjaHJvb3QuCnNtdHBkX21pbHRlcnMgPSBpbmV0OjEyNy4wLjAuMTo4ODkxCiMg\
|
|
U2VuZCBtYWlsIHRoYXQgZG9lc24ndCBhcnJpdmUgZnJvbSB0aGUgbmV0d29yayB0aHJvdWdoIHRo\
|
|
ZSBzYW1lIG1pbHRlcgojIGFzIG91dGJvdW5kIG1haWwuCm5vbl9zbXRwZF9taWx0ZXJzID0gJHNt\
|
|
dHBkX21pbHRlcnMK' |base64 -d >> /etc/postfix/main.cf
|
|
COPY opendkim.conf /etc/opendkim
|
|
|
|
VOLUME ["/var/spool/postfix"]
|
|
EXPOSE 25
|
|
|
|
COPY init /sbin/
|
|
|
|
# Starting
|
|
ENTRYPOINT [ "/sbin/init" ]
|