FROM alpine
LABEL maintainer="Disassembler <disassembler@dasm.cz>"

RUN \
 # Create OS user (which will be picked up later by apk add)
 addgroup -S -g 587 postfix \
 && adduser -S -u 587 -h /var/spool/postfix -s /bin/false -g postfix -G postfix postfix \
 # Install Postfix
 && apk --no-cache add ca-certificates postfix \
 # Build aliases database
 && newaliases \
 # Cleanup
 && sed -ir '/^(#.*)?$/d' /etc/postfix/aliases \
 && rm -r /etc/postfix/access /etc/postfix/canonical /etc/postfix/dynamicmaps.cf* /etc/postfix/generic /etc/postfix/header_checks /etc/postfix/postfix-files.d /etc/postfix/relocated /etc/postfix/transport /etc/postfix/virtual

COPY docker/ /

VOLUME ["/etc/postfix", "/var/spool/postfix"]
EXPOSE 25

CMD ["s6-svscan", "/etc/services.d"]
