blob: 4e90052bdf4f68af290ab77c28f8775cc606ee4f [file] [log] [blame]
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +01001FROM debian:bullseye-slim
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01002LABEL maintainer "Andre Peters <andre.peters@servercow.de>"
3
4ARG DEBIAN_FRONTEND=noninteractive
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +01005ARG DOVECOT=2.3.19.1
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01006ENV LC_ALL C
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +01007ENV GOSU_VERSION 1.14
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01008
9# Add groups and users before installing Dovecot to not break compatibility
10RUN groupadd -g 5000 vmail \
11 && groupadd -g 401 dovecot \
12 && groupadd -g 402 dovenull \
13 && groupadd -g 999 sogo \
14 && usermod -a -G sogo nobody \
15 && useradd -g vmail -u 5000 vmail -d /var/vmail \
16 && useradd -c "Dovecot unprivileged user" -d /dev/null -u 401 -g dovecot -s /bin/false dovecot \
17 && useradd -c "Dovecot login user" -d /dev/null -u 402 -g dovenull -s /bin/false dovenull \
18 && touch /etc/default/locale \
19 && apt-get update \
20 && apt-get -y --no-install-recommends install \
21 apt-transport-https \
22 ca-certificates \
23 cpanminus \
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010024 curl \
25 dnsutils \
26 dirmngr \
27 gettext \
28 gnupg2 \
29 jq \
30 libauthen-ntlm-perl \
31 libcgi-pm-perl \
32 libcrypt-openssl-rsa-perl \
33 libcrypt-ssleay-perl \
34 libdata-uniqid-perl \
35 libdbd-mysql-perl \
36 libdbi-perl \
37 libdigest-hmac-perl \
38 libdist-checkconflicts-perl \
39 libencode-imaputf7-perl \
40 libfile-copy-recursive-perl \
41 libfile-tail-perl \
42 libhtml-parser-perl \
43 libio-compress-perl \
44 libio-socket-inet6-perl \
45 libio-socket-ssl-perl \
46 libio-tee-perl \
47 libipc-run-perl \
48 libjson-webtoken-perl \
49 liblockfile-simple-perl \
50 libmail-imapclient-perl \
51 libmodule-implementation-perl \
52 libmodule-scandeps-perl \
53 libnet-ssleay-perl \
54 libpackage-stash-perl \
55 libpackage-stash-xs-perl \
56 libpar-packer-perl \
57 libparse-recdescent-perl \
58 libproc-processtable-perl \
59 libreadonly-perl \
60 libregexp-common-perl \
61 libsys-meminfo-perl \
62 libterm-readkey-perl \
63 libtest-deep-perl \
64 libtest-fatal-perl \
65 libtest-mock-guard-perl \
66 libtest-mockobject-perl \
67 libtest-nowarnings-perl \
68 libtest-pod-perl \
69 libtest-requires-perl \
70 libtest-simple-perl \
71 libtest-warn-perl \
72 libtry-tiny-perl \
73 libunicode-string-perl \
74 liburi-perl \
75 libwww-perl \
76 lua-sql-mysql \
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020077 lua-socket \
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010078 mariadb-client \
79 procps \
80 python3-pip \
81 redis-server \
82 supervisor \
83 syslog-ng \
84 syslog-ng-core \
85 syslog-ng-mod-redis \
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020086 wget \
87 && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
88 && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
89 && chmod +x /usr/local/bin/gosu \
90 && gosu nobody true \
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010091 && apt-key adv --fetch-keys https://repo.dovecot.org/DOVECOT-REPO-GPG \
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010092 && echo "deb https://repo.dovecot.org/ce-${DOVECOT}/debian/bullseye bullseye main" > /etc/apt/sources.list.d/dovecot.list \
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010093 && apt-get update \
94 && apt-get -y --no-install-recommends install \
95 dovecot-lua \
96 dovecot-managesieved \
97 dovecot-sieve \
98 dovecot-lmtpd \
99 dovecot-ldap \
100 dovecot-mysql \
101 dovecot-core \
102 dovecot-pop3d \
103 dovecot-imapd \
104 dovecot-solr \
105 && pip3 install mysql-connector-python html2text jinja2 redis \
106 && apt-get autoremove --purge -y \
107 && apt-get autoclean \
108 && rm -rf /var/lib/apt/lists/* \
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200109 && rm -rf /tmp/* /var/tmp/* /root/.cache/
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100110
111COPY trim_logs.sh /usr/local/bin/trim_logs.sh
112COPY clean_q_aged.sh /usr/local/bin/clean_q_aged.sh
113COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
114COPY syslog-ng-redis_slave.conf /etc/syslog-ng/syslog-ng-redis_slave.conf
115COPY imapsync /usr/local/bin/imapsync
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200116COPY imapsync_runner.pl /usr/local/bin/imapsync_runner.pl
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100117COPY report-spam.sieve /usr/lib/dovecot/sieve/report-spam.sieve
118COPY report-ham.sieve /usr/lib/dovecot/sieve/report-ham.sieve
119COPY rspamd-pipe-ham /usr/lib/dovecot/sieve/rspamd-pipe-ham
120COPY rspamd-pipe-spam /usr/lib/dovecot/sieve/rspamd-pipe-spam
121COPY sa-rules.sh /usr/local/bin/sa-rules.sh
122COPY maildir_gc.sh /usr/local/bin/maildir_gc.sh
123COPY docker-entrypoint.sh /
124COPY supervisord.conf /etc/supervisor/supervisord.conf
125COPY stop-supervisor.sh /usr/local/sbin/stop-supervisor.sh
126COPY quarantine_notify.py /usr/local/bin/quarantine_notify.py
127COPY quota_notify.py /usr/local/bin/quota_notify.py
128COPY repl_health.sh /usr/local/bin/repl_health.sh
129
130ENTRYPOINT ["/docker-entrypoint.sh"]
131CMD exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf