diff --git a/Dockerfile b/Dockerfile index 82535fa0..e30d589c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,9 @@ FROM docker.io/debian:11-slim AS stage-base -ARG LOG_LEVEL=trace ARG DEBIAN_FRONTEND=noninteractive +ARG DOVECOT_COMMUNITY_REPO=0 +ARG LOG_LEVEL=trace SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/target/scripts/build/packages.sh b/target/scripts/build/packages.sh index 52fe5d86..3d0e05b5 100644 --- a/target/scripts/build/packages.sh +++ b/target/scripts/build/packages.sh @@ -43,16 +43,10 @@ function _install_packages { _log 'debug' 'Installing all packages now' - declare -a DOVECOT_PACKAGES ANTI_VIRUS_SPAM_PACKAGES + declare -a ANTI_VIRUS_SPAM_PACKAGES declare -a CODECS_PACKAGES MISCELLANEOUS_PACKAGES declare -a POSTFIX_PACKAGES MAIL_PROGRAMS_PACKAGES - DOVECOT_PACKAGES=( - dovecot-core dovecot-fts-xapian dovecot-imapd - dovecot-ldap dovecot-lmtpd dovecot-managesieved - dovecot-pop3d dovecot-sieve dovecot-solr - ) - ANTI_VIRUS_SPAM_PACKAGES=( amavisd-new clamav clamav-daemon pyzor razor spamassassin @@ -89,7 +83,6 @@ function _install_packages ) apt-get "${QUIET}" --no-install-recommends install \ - "${DOVECOT_PACKAGES[@]}" \ "${ANTI_VIRUS_SPAM_PACKAGES[@]}" \ "${CODECS_PACKAGES[@]}" \ "${MISCELLANEOUS_PACKAGES[@]}" \ @@ -97,6 +90,31 @@ function _install_packages "${MAIL_PROGRAMS_PACKAGES[@]}" } +function _install_dovecot +{ + declare -a DOVECOT_PACKAGES + + DOVECOT_PACKAGES=( + dovecot-core dovecot-fts-xapian dovecot-imapd + dovecot-ldap dovecot-lmtpd dovecot-managesieved + dovecot-pop3d dovecot-sieve dovecot-solr + ) + + if [[ ${DOVECOT_COMMUNITY_REPO} -eq 1 ]] + then + _log 'trace' 'Using Dovecot community repository' + curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import + gpg --export ED409DA1 > /etc/apt/trusted.gpg.d/dovecot.gpg + echo "deb https://repo.dovecot.org/ce-2.3-latest/debian/bullseye bullseye main" > /etc/apt/sources.list.d/dovecot.list + + _log 'trace' 'Updating Dovecot package signatures' + apt-get "${QUIET}" update + fi + + _log 'debug' 'Installing Dovecot' + apt-get "${QUIET}" --no-install-recommends install "${DOVECOT_PACKAGES[@]}" +} + function _install_fail2ban { local FAIL2BAN_DEB_URL='https://github.com/fail2ban/fail2ban/releases/download/0.11.2/fail2ban_0.11.2-1.upstream1_all.deb' @@ -142,5 +160,6 @@ function _post_installation_steps _pre_installation_steps _install_postfix _install_packages +_install_dovecot _install_fail2ban _post_installation_steps