2020-10-27 11:21:10 +00:00
|
|
|
FROM debian:buster-slim
|
|
|
|
|
2020-11-07 17:43:25 +00:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
2020-10-31 17:19:13 +00:00
|
|
|
|
|
|
|
# Install packages
|
2020-10-27 11:21:10 +00:00
|
|
|
RUN \
|
|
|
|
apt-get update \
|
|
|
|
&& apt-get upgrade -y \
|
|
|
|
&& apt-get install -y --no-install-recommends \
|
|
|
|
dovecot-core \
|
|
|
|
dovecot-imapd \
|
|
|
|
dovecot-lmtpd \
|
2020-11-07 17:43:25 +00:00
|
|
|
dovecot-pop3d \
|
2020-10-27 11:21:10 +00:00
|
|
|
opendkim \
|
|
|
|
opendkim-tools \
|
2020-10-31 17:19:13 +00:00
|
|
|
openssl \
|
2020-11-07 17:43:25 +00:00
|
|
|
postfix \
|
2020-11-22 19:14:59 +00:00
|
|
|
procps \
|
2020-11-07 17:43:25 +00:00
|
|
|
rsyslog \
|
2020-11-22 19:14:59 +00:00
|
|
|
s6 \
|
2020-10-27 11:21:10 +00:00
|
|
|
&& apt-get autoclean \
|
|
|
|
&& apt-get autoremove
|
|
|
|
|
2020-10-31 17:19:13 +00:00
|
|
|
# Setup folders and users
|
2020-10-27 11:21:10 +00:00
|
|
|
RUN \
|
2020-11-07 17:43:25 +00:00
|
|
|
groupadd -g 2222 vmail \
|
2020-10-31 17:19:13 +00:00
|
|
|
&& useradd -d /var/mail -M -s /usr/sbin/nologin -u 2222 -g 2222 vmail \
|
2020-10-27 11:21:10 +00:00
|
|
|
&& usermod -aG vmail postfix \
|
|
|
|
&& usermod -aG vmail dovecot \
|
|
|
|
&& usermod -aG vmail opendkim\
|
|
|
|
&& mkdir -p -m 751 /var/mail/ \
|
|
|
|
&& mkdir -p -m 755 /etc/mail/ \
|
2020-11-07 17:43:25 +00:00
|
|
|
&& chown vmail:vmail /var/mail
|
2020-10-27 11:21:10 +00:00
|
|
|
|
|
|
|
# Copy config files
|
|
|
|
COPY rootfs/ /
|
|
|
|
|
2020-11-22 19:14:59 +00:00
|
|
|
RUN \
|
|
|
|
touch /etc/mail/aliases /etc/mail/domains /etc/mail/mailboxes /etc/mail/passwd \
|
|
|
|
&& postmap /etc/mail/aliases && postmap /etc/mail/domains && postmap /etc/mail/mailboxes
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
chmod +x /etc/service/postfix/run \
|
|
|
|
&& chmod +x /etc/service/dovecot/run \
|
|
|
|
&& chmod +x /etc/service/opendkim/run \
|
|
|
|
&& chmod +x /etc/service/rsyslog/run
|
|
|
|
|
2020-10-31 17:19:13 +00:00
|
|
|
# Expose ports
|
2020-11-22 19:14:59 +00:00
|
|
|
EXPOSE 25 110 143 587 993 995
|
2020-10-27 11:21:10 +00:00
|
|
|
|
2020-10-31 17:19:13 +00:00
|
|
|
# Run start script
|
2020-10-27 11:21:10 +00:00
|
|
|
ENTRYPOINT /usr/bin/start.sh
|