forked from gw0/docker-dovecot-getmail
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
57 lines (51 loc) · 2.38 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Private email gateway with getmail and dovecot
#
# Author: gw0 [http://gw.tnode.com/] <gw.2021@ena.one>
FROM debian:buster-slim
MAINTAINER gw0 [http://gw.tnode.com/] <gw.2021@ena.one>
# install debian packages
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y \
cron \
getmail \
dovecot-imapd \
dovecot-managesieved \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# configure dovecot
RUN sed -i 's/#log_path = syslog/log_path = \/var\/log\/dovecot\/dovecot.log/' /etc/dovecot/conf.d/10-logging.conf \
# authentication
&& sed -i 's/#auth_verbose =.*/auth_verbose = yes/' /etc/dovecot/conf.d/10-logging.conf \
# ssl
&& sed -i 's/^ssl =.*/ssl = required/' /etc/dovecot/conf.d/10-ssl.conf \
&& sed -i 's/#\?ssl_cert =.*/ssl_cert = <\/etc\/ssl\/private\/dovecot.crt/' /etc/dovecot/conf.d/10-ssl.conf \
&& sed -i 's/#\?ssl_key =.*/ssl_key = <\/etc\/ssl\/private\/dovecot.key/' /etc/dovecot/conf.d/10-ssl.conf \
# mailboxes
&& sed -i 's/^mail_location =.*/mail_location = maildir:~\/Maildir:LAYOUT=fs/' /etc/dovecot/conf.d/10-mail.conf \
&& sed -i 's/#separator = $/separator = \//' /etc/dovecot/conf.d/10-mail.conf \
&& sed -i 's/#lda_mailbox_autocreate =.*/lda_mailbox_autocreate = yes/' /etc/dovecot/conf.d/15-lda.conf \
&& sed -i 's/#lda_mailbox_autosubscribe =.*/lda_mailbox_autosubscribe = yes/' /etc/dovecot/conf.d/15-lda.conf \
# sieve plugin
&& sed -i 's/#mail_plugins = \$mail_plugins/mail_plugins = \$mail_plugins sieve/' /etc/dovecot/conf.d/15-lda.conf \
&& sed -i 's/#protocols = \$protocols sieve/protocols = \$protocols sieve/g' /etc/dovecot/conf.d/20-managesieve.conf \
# imap idle
&& sed -i 's/#imap_idle_notify_interval =.*/imap_idle_notify_interval = 29 mins/' /etc/dovecot/conf.d/20-imap.conf \
# fix getmail imap issue with large emails
&& sed -i 's/^_MAXLINE =.*/_MAXLINE = 10000000/' /usr/lib/python2.7/imaplib.py
# fix permission issues with stats-writer
ADD dovecot-conf.d/20-stats.conf /etc/dovecot/conf.d/20-stats.conf
# setup entrypoint
ENV TZ=UTC
ENV CRON='*/30 * * * *'
ENV DEFAULT_PASSWD="replaceMeNow"
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 143
EXPOSE 993
EXPOSE 4190
#VOLUME /home
#VOLUME /etc/cron.d
#VOLUME /etc/ssl/private
ENTRYPOINT ["/entrypoint.sh"]
CMD ["tail", "--follow", "--retry", "/var/log/dovecot/dovecot.log", "/var/log/getmail/*.log"]