Add postfix and dovecot dockerfiles, added dovecot deployment (in dev)

This commit is contained in:
2023-10-05 16:26:51 +02:00
parent 1b726dc515
commit 80a4ac2156
14 changed files with 196 additions and 23 deletions

View File

@@ -0,0 +1,18 @@
FROM alpine:latest
RUN apk --no-cache add dovecot dovecot-lmtpd dovecot-submissiond bash
# RUN wget https://github.com/dovecot/docker/blob/main/2.3.21/dovecot.gpg
# RUN cp dovecot.gpg /etc/apt/keyrings/dovecot.gpg
# RUN wget https://github.com/dovecot/docker/blob/main/2.3.21/dovecot.list
# RUN cp dovecot.list /etc/apt/sources.list.d
COPY password_file /etc/dovecot/secrets/dovecot_password.file
COPY dovecot.conf /etc/dovecot/dovecot.conf
EXPOSE 24
EXPOSE 143
EXPOSE 993
CMD [ "dovecot", "-F" ]

View File

@@ -0,0 +1,48 @@
## You should mount /etc/dovecot if you want to
## manage this file
mail_home=/srv/mail/%Lu
mail_location=sdbox:~/Mail
mail_uid=1000
mail_gid=10000
protocols = imap submission lmtp
first_valid_uid = 1000
last_valid_uid = 10000
# authentication via passwd-file, see https://doc.dovecot.org/configuration_manual/authentication/passwd_file/#authentication-passwd-file
passdb {
driver = passwd-file
args = /etc/dovecot/secrets/dovecot_password_file
}
# post-login user lookup database, see https://doc.dovecot.org/configuration_manual/authentication/user_databases_userdb/#authentication-user-database
userdb {
driver = passwd-file
args = /etc/dovecot/secrets/dovecot_password_file
default_fields = home=/home/%u
}
ssl=no
# ssl_cert=<cert.pem
# ssl_key=<key.pem
namespace {
inbox = yes
separator = /
}
service lmtp {
inet_listener {
port = 24
}
}
listen = *
log_path=/dev/stdout
info_log_path=/dev/stdout
debug_log_path=/dev/stdout
!include_try /etc/dovecot/conf.d/*.conf

View File

@@ -0,0 +1,2 @@
user:{plain}password
user2:{plain}password2

View File

@@ -0,0 +1,14 @@
FROM alpine:latest
RUN apk --no-cache add postfix bash openssl
COPY startup.sh /usr/bin/startup.sh
RUN chmod +x /usr/bin/startup.sh
COPY main.cf /etc/postfix/main.cf
COPY virtual /etc/postfix/virtual
EXPOSE 25
EXPOSE 465
EXPOSE 587
CMD [ "startup.sh" ]

View File

@@ -0,0 +1,14 @@
# Log everything to standard out
maillog_file = /dev/stdout
# this setting has several side-effects, e.g. the domain of this mail
# server is now example.com, http://www.postfix.org/postconf.5.html#mydomain
myhostname = mail.virt.local
# disable all compatibility levels
compatibility_level = 9999
virtual_mailbox_domains = main.virt.local
virtual_mailbox_maps = lmdb:/etc/postfix/virtual
virtual_alias_maps = lmdb:/etc/postfix/virtual
virtual_transport = lmtp:dovecot.default.svc.cluster.local:24

View File

@@ -0,0 +1,8 @@
#!/bin/bash
set -ex
postmap /etc/postfix/virtual
newaliases
exec postfix start-fg

View File

@@ -0,0 +1 @@
@mail.virt.local