summaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile42
1 files changed, 42 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..7eafaf1
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,42 @@
+FROM debian
+
+ARG HOSTNAME
+ARG VIRTUAL_DOMAINS
+ENV DEBIAN_FRONTEND=noninteractive
+
+# Create system users with fixed, well-known UID/GIDs
+RUN useradd \
+ --uid 2000 --system \
+ --shell /usr/sbin/nologin \
+ --home-dir /var/mail/vhost \
+ --skel /dev/null --create-home \
+ vmailbox
+
+RUN useradd \
+ --uid 2001 --system \
+ --shell /usr/sbin/nologin \
+ --home-dir /var/spool/postfix \
+ postfix
+
+# Install packages
+RUN apt update \
+ && apt full-upgrade --yes \
+ && apt install --yes \
+ dovecot-core \
+ dovecot-imapd \
+ postfix \
+ && apt clean
+
+# Install files
+COPY dovecot /etc/dovecot/
+COPY postfix /etc/postfix/
+COPY userconfig /etc/userconfig/
+
+RUN find /etc/dovecot /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