Dockerfile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. FROM debian:bullseye-slim
  2. LABEL maintainer "The Infrastructure Company GmbH <info@servercow.de>"
  3. ARG DEBIAN_FRONTEND=noninteractive
  4. # renovate: datasource=github-tags depName=dovecot/core versioning=semver-coerced extractVersion=(?<version>.*)$
  5. ARG DOVECOT=2.3.21
  6. # renovate: datasource=github-releases depName=tianon/gosu versioning=semver-coerced extractVersion=(?<version>.*)$
  7. ARG GOSU_VERSION=1.16
  8. ENV LC_ALL C
  9. # Add groups and users before installing Dovecot to not break compatibility
  10. RUN 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. build-essential \
  22. apt-transport-https \
  23. ca-certificates \
  24. cpanminus \
  25. curl \
  26. dnsutils \
  27. dirmngr \
  28. gettext \
  29. gnupg2 \
  30. jq \
  31. libauthen-ntlm-perl \
  32. libcgi-pm-perl \
  33. libcrypt-openssl-rsa-perl \
  34. libcrypt-ssleay-perl \
  35. libdata-uniqid-perl \
  36. libdbd-mysql-perl \
  37. libdbi-perl \
  38. libdigest-hmac-perl \
  39. libdist-checkconflicts-perl \
  40. libencode-imaputf7-perl \
  41. libfile-copy-recursive-perl \
  42. libfile-tail-perl \
  43. libhtml-parser-perl \
  44. libio-compress-perl \
  45. libio-socket-inet6-perl \
  46. libio-socket-ssl-perl \
  47. libio-tee-perl \
  48. libipc-run-perl \
  49. libjson-webtoken-perl \
  50. liblockfile-simple-perl \
  51. libmail-imapclient-perl \
  52. libmodule-implementation-perl \
  53. libmodule-scandeps-perl \
  54. libnet-ssleay-perl \
  55. libpackage-stash-perl \
  56. libpackage-stash-xs-perl \
  57. libpar-packer-perl \
  58. libparse-recdescent-perl \
  59. libproc-processtable-perl \
  60. libreadonly-perl \
  61. libregexp-common-perl \
  62. libssl-dev \
  63. libsys-meminfo-perl \
  64. libterm-readkey-perl \
  65. libtest-deep-perl \
  66. libtest-fatal-perl \
  67. libtest-mock-guard-perl \
  68. libtest-mockobject-perl \
  69. libtest-nowarnings-perl \
  70. libtest-pod-perl \
  71. libtest-requires-perl \
  72. libtest-simple-perl \
  73. libtest-warn-perl \
  74. libtry-tiny-perl \
  75. libunicode-string-perl \
  76. liburi-perl \
  77. libwww-perl \
  78. lua-sql-mysql \
  79. lua-socket \
  80. mariadb-client \
  81. procps \
  82. python3-pip \
  83. redis-server \
  84. supervisor \
  85. syslog-ng \
  86. syslog-ng-core \
  87. syslog-ng-mod-redis \
  88. wget \
  89. && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
  90. && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
  91. && chmod +x /usr/local/bin/gosu \
  92. && gosu nobody true \
  93. && apt-key adv --fetch-keys https://repo.dovecot.org/DOVECOT-REPO-GPG \
  94. && echo "deb https://repo.dovecot.org/ce-${DOVECOT}/debian/bullseye bullseye main" > /etc/apt/sources.list.d/dovecot.list \
  95. && apt-get update \
  96. && apt-get -y --no-install-recommends install \
  97. dovecot-lua \
  98. dovecot-managesieved \
  99. dovecot-sieve \
  100. dovecot-lmtpd \
  101. dovecot-ldap \
  102. dovecot-mysql \
  103. dovecot-core \
  104. dovecot-pop3d \
  105. dovecot-imapd \
  106. dovecot-solr \
  107. && pip3 install mysql-connector-python html2text jinja2 redis \
  108. && apt-get autoremove --purge -y \
  109. && apt-get autoclean \
  110. && rm -rf /var/lib/apt/lists/* \
  111. && rm -rf /tmp/* /var/tmp/* /root/.cache/
  112. # imapsync dependencies
  113. RUN cpan Crypt::OpenSSL::PKCS12
  114. COPY trim_logs.sh /usr/local/bin/trim_logs.sh
  115. COPY clean_q_aged.sh /usr/local/bin/clean_q_aged.sh
  116. COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
  117. COPY syslog-ng-redis_slave.conf /etc/syslog-ng/syslog-ng-redis_slave.conf
  118. COPY imapsync /usr/local/bin/imapsync
  119. COPY imapsync_runner.pl /usr/local/bin/imapsync_runner.pl
  120. COPY report-spam.sieve /usr/lib/dovecot/sieve/report-spam.sieve
  121. COPY report-ham.sieve /usr/lib/dovecot/sieve/report-ham.sieve
  122. COPY rspamd-pipe-ham /usr/lib/dovecot/sieve/rspamd-pipe-ham
  123. COPY rspamd-pipe-spam /usr/lib/dovecot/sieve/rspamd-pipe-spam
  124. COPY sa-rules.sh /usr/local/bin/sa-rules.sh
  125. COPY maildir_gc.sh /usr/local/bin/maildir_gc.sh
  126. COPY docker-entrypoint.sh /
  127. COPY supervisord.conf /etc/supervisor/supervisord.conf
  128. COPY stop-supervisor.sh /usr/local/sbin/stop-supervisor.sh
  129. COPY quarantine_notify.py /usr/local/bin/quarantine_notify.py
  130. COPY quota_notify.py /usr/local/bin/quota_notify.py
  131. COPY repl_health.sh /usr/local/bin/repl_health.sh
  132. ENTRYPOINT ["/docker-entrypoint.sh"]
  133. CMD exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf