mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Dovecot: compile fts_xapian
from source to match Dovecot ABI (#3373)
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> Co-authored-by: Casper <casperklein@users.noreply.github.com>
This commit is contained in:
parent
e68062282a
commit
efed9d8012
49
Dockerfile
49
Dockerfile
|
@ -1,18 +1,18 @@
|
|||
# syntax=docker.io/docker/dockerfile:1
|
||||
|
||||
# This Dockerfile provides two stages: stage-base and stage-final
|
||||
# This Dockerfile provides four stages: stage-base, stage-compile, stage-main and stage-final
|
||||
# This is in preparation for more granular stages (eg ClamAV and Fail2Ban split into their own)
|
||||
|
||||
#
|
||||
# Base stage provides all packages, config, and adds scripts
|
||||
#
|
||||
|
||||
FROM docker.io/debian:11-slim AS stage-base
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG DOVECOT_COMMUNITY_REPO=1
|
||||
ARG LOG_LEVEL=trace
|
||||
|
||||
FROM docker.io/debian:11-slim AS stage-base
|
||||
|
||||
ARG DEBIAN_FRONTEND
|
||||
ARG DOVECOT_COMMUNITY_REPO
|
||||
ARG LOG_LEVEL
|
||||
|
||||
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
||||
|
||||
# -----------------------------------------------
|
||||
|
@ -25,11 +25,37 @@ RUN <<EOF
|
|||
adduser --quiet --system --group --disabled-password --home /var/lib/clamav --no-create-home --uid 200 clamav
|
||||
EOF
|
||||
|
||||
COPY target/scripts/build/* /build/
|
||||
COPY target/scripts/build/packages.sh /build/
|
||||
COPY target/scripts/helpers/log.sh /usr/local/bin/helpers/log.sh
|
||||
|
||||
RUN /bin/bash /build/packages.sh && rm -r /build
|
||||
|
||||
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Compile deb packages ----------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
FROM stage-base AS stage-compile
|
||||
|
||||
ARG LOG_LEVEL
|
||||
ARG DEBIAN_FRONTEND
|
||||
|
||||
COPY target/scripts/build/compile.sh /build/
|
||||
RUN /bin/bash /build/compile.sh
|
||||
|
||||
#
|
||||
# main stage provides all packages, config, and adds scripts
|
||||
#
|
||||
|
||||
FROM stage-base AS stage-main
|
||||
|
||||
ARG DEBIAN_FRONTEND
|
||||
ARG LOG_LEVEL
|
||||
|
||||
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
||||
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- ClamAV & FeshClam -------------------------
|
||||
# -----------------------------------------------
|
||||
|
@ -56,6 +82,11 @@ EOF
|
|||
# --- Dovecot -----------------------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
# install fts_xapian plugin
|
||||
|
||||
COPY --from=stage-compile dovecot-fts-xapian-1.5.5_1.5.5_*.deb /
|
||||
RUN dpkg -i /dovecot-fts-xapian-1.5.5_1.5.5_*.deb && rm /dovecot-fts-xapian-1.5.5_1.5.5_*.deb
|
||||
|
||||
COPY target/dovecot/*.inc target/dovecot/*.conf /etc/dovecot/conf.d/
|
||||
COPY target/dovecot/dovecot-purge.cron /etc/cron.d/dovecot-purge.disabled
|
||||
RUN chmod 0 /etc/cron.d/dovecot-purge.disabled
|
||||
|
@ -265,7 +296,7 @@ COPY target/scripts/startup/setup.d /usr/local/bin/setup.d
|
|||
# Final stage focuses only on image config
|
||||
#
|
||||
|
||||
FROM stage-base AS stage-final
|
||||
FROM stage-main AS stage-final
|
||||
ARG VCS_REVISION=unknown
|
||||
ARG VCS_VERSION=edge
|
||||
|
||||
|
|
30
target/scripts/build/compile.sh
Normal file
30
target/scripts/build/compile.sh
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# -eE :: exit on error (do this in functions as well)
|
||||
# -u :: show (and exit) when using unset variables
|
||||
# -o pipefail :: exit on error in pipes
|
||||
set -eE -u -o pipefail
|
||||
|
||||
# shellcheck source=../helpers/log.sh
|
||||
source /usr/local/bin/helpers/log.sh
|
||||
|
||||
_log_level_is 'trace' && QUIET='-y' || QUIET='-qq'
|
||||
|
||||
function _compile_dovecot_fts_xapian() {
|
||||
apt-get "${QUIET}" update
|
||||
apt-get "${QUIET}" --no-install-recommends install automake libtool pkg-config libicu-dev libsqlite3-dev libxapian-dev make build-essential dh-make devscripts dovecot-dev
|
||||
curl -Lso dovecot-fts-xapian.tar.gz https://github.com/grosjo/fts-xapian/releases/download/1.5.5/dovecot-fts-xapian-1.5.5.tar.gz
|
||||
tar xzvf dovecot-fts-xapian.tar.gz
|
||||
cd fts-xapian-1.5.5
|
||||
USER=root dh_make -p dovecot-fts-xapian-1.5.5 --single --native --copyright gpl2 -y
|
||||
rm debian/*.ex debian/*.EX
|
||||
cp PACKAGES/DEB/control debian/
|
||||
cp PACKAGES/DEB/changelog debian/
|
||||
cp PACKAGES/DEB/compat debian/
|
||||
sed -i 's/1\.4\.11-6/1.5.5/g' debian/control
|
||||
sed -i 's/1\.4\.11-6/1.5.5/g' debian/changelog
|
||||
|
||||
debuild -us -uc -B | tee /tmp/debuild.log 2>&1
|
||||
}
|
||||
|
||||
_compile_dovecot_fts_xapian
|
|
@ -94,26 +94,12 @@ function _install_dovecot() {
|
|||
declare -a DOVECOT_PACKAGES
|
||||
|
||||
DOVECOT_PACKAGES=(
|
||||
dovecot-core dovecot-fts-xapian dovecot-imapd
|
||||
dovecot-core dovecot-imapd
|
||||
dovecot-ldap dovecot-lmtpd dovecot-managesieved
|
||||
dovecot-pop3d dovecot-sieve dovecot-solr
|
||||
)
|
||||
|
||||
if [[ ${DOVECOT_COMMUNITY_REPO} -eq 1 ]]; then
|
||||
# The package dovecot-fts-xapian is installed from the debian repository.
|
||||
# Starting with version 1.4.9a-1+deb11u1, a new dependency was added: dovecot-abi-2.3.abiv13
|
||||
# dovecot-abi-2.3.abiv13 is a virtual package provided by dovecot-core (from the debian repository).
|
||||
# However dovecot-core from the community repository provides dovecot-abi-2.3.abiv19.
|
||||
_log 'trace' "Create and install dummy package 'dovecot-abi-2.3.abiv13' to satisfy 'dovecot-fts-xapian' dependency"
|
||||
apt-get "${QUIET}" --no-install-recommends install checkinstall
|
||||
echo -e 'install:\n\t@true' > Makefile
|
||||
echo 'Dummy package to satisfy dovecot-fts-xapian dependency' > description-pak
|
||||
checkinstall -y --install=yes --pkgname="dovecot-abi-2.3.abiv13" --pkgversion=1 --maintainer=Nobody --pkggroup=mail
|
||||
# Cleanup
|
||||
rm description-pak dovecot-abi-2.3.abiv13*.deb Makefile
|
||||
apt-get "${QUIET}" purge checkinstall
|
||||
apt-get "${QUIET}" autoremove
|
||||
|
||||
_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
|
||||
|
@ -125,6 +111,9 @@ function _install_dovecot() {
|
|||
|
||||
_log 'debug' 'Installing Dovecot'
|
||||
apt-get "${QUIET}" --no-install-recommends install "${DOVECOT_PACKAGES[@]}"
|
||||
|
||||
# dependency for fts_xapian
|
||||
apt-get "${QUIET}" --no-install-recommends install libxapian30
|
||||
}
|
||||
|
||||
function _install_rspamd() {
|
||||
|
|
Loading…
Reference in a new issue