blob: aa7c1ca97273da7f0294ac1b1351cd8cb7df5077 (
plain) (
tree)
|
|
FROM debian
ARG HOSTNAME
ARG VIRTUAL_DOMAINS
ENV DEBIAN_FRONTEND=noninteractive
# Create system users with fixed, well-known UID/GIDs
RUN useradd \
--uid 2000 \
--shell /usr/sbin/nologin \
--home-dir /var/mail/vhost \
--skel /dev/null --create-home \
vmailbox
RUN useradd \
--uid 2001 \
--shell /usr/sbin/nologin \
--home-dir /var/spool/postfix \
postfix
RUN useradd \
--uid 2002 \
--shell /usr/sbin/nologin \
--home-dir /var/spool/mlmmj \
--skel /dev/null --create-home \
mlmmj
RUN useradd \
--uid 2003 \
--shell /usr/sbin/nologin \
--home-dir /run/opendkim \
opendkim
RUN usermod -aG opendkim postfix
# Install packages
RUN apt update \
&& apt full-upgrade --yes \
&& apt install --yes \
dovecot-core \
dovecot-imapd \
mlmmj \
opendkim \
postfix \
postfix-pcre \
sudo \
&& apt clean
# Generate OpenDKIM keypair
# Do this here so we can print the pubkey/dns record to logs during build
# process. After initial run, a volume should preserve the keys for later
# runs.
RUN mkdir -p /opendkim \
&& chown opendkim:opendkim /opendkim \
&& opendkim-genkey \
--bits=1024 \
--directory=/opendkim \
--selector=default \
&& cat /opendkim/default.txt
# Install files
COPY dovecot /etc/dovecot/
COPY opendkim /etc/
COPY postfix /etc/postfix/
COPY userconfig /etc/userconfig/
RUN find /etc/dovecot /etc/opendkim.conf /etc/postfix -type f | xargs sed -i \
"s/ENV_HOSTNAME/${HOSTNAME}/g; s/ENV_VIRTUAL_DOMAINS/${VIRTUAL_DOMAINS}/g"
EXPOSE 25
EXPOSE 80
EXPOSE 465
EXPOSE 993
# CMD set by docker-compose.yml
|