From 99dcc255f15503d877b98b76966cc1ac187406cf Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Thu, 15 Feb 2018 21:40:42 +0100 Subject: [PATCH] build dovecot from source --- Dockerfile | 62 ++++++++++++++++++++++++++++++++++++---------------- i_zero.patch | 12 ---------- 2 files changed, 43 insertions(+), 31 deletions(-) delete mode 100644 i_zero.patch diff --git a/Dockerfile b/Dockerfile index 4f11c89..755fbfc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,54 @@ +FROM alpine as builder + +RUN apk --no-cache add \ + rpcgen \ + g++ \ + make \ + libressl \ + libressl-dev \ + lua-dev \ + openldap-dev \ + libsodium-dev \ + linux-pam-dev \ + zlib-dev \ + bzip2-dev \ + xz-dev \ + lz4-dev \ + icu-dev + +RUN mkdir /tmp/dovecot +RUN wget -qO- https://www.dovecot.org/releases/2.3/dovecot-2.3.0.tar.gz | tar -xz -C /tmp/dovecot --strip 2 + +RUN mkdir /tmp/pigeonhole +RUN wget -qO- https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-0.5.0.1.tar.gz | tar -xz -C /tmp/pigeonhole --strip 1 + +RUN cd /tmp/dovecot && \ + ./configure --prefix '' --with-lua --with-zlib --with-bzlib --with-pam --with-ssl=openssl --with-sodium --without-sql --with-ldap --with-lzma --with-lz4 --with-icu --without-shadow --with-ssldir=/etc/ssl/dovecot --with-rundir=/run/dovecot --without-shared-libs && \ + make && \ + make install + +RUN cd /tmp/pigeonhole && \ + ./configure --with-ldap=yes --with-dovecot=/lib/dovecot && \ + make && make install + FROM registry.gitlab.com/thallian/docker-confd-env:master -ADD i_zero.patch /usr/include/dovecot/i_zero.patch +COPY --from=builder /lib/dovecot/ /lib/dovecot/ +COPY --from=builder /bin/doveadm /bin/doveadm +COPY --from=builder /bin/doveconf /bin/doveconf +COPY --from=builder /sbin/dovecot /sbin/dovecot +#COPY --from=builder /share/doc/dovecot/example-config/ /etc/dovecot/ -RUN apk add --no-cache dovecot dovecot-ldap libressl ssmtp ca-certificates g++ openldap-dev dovecot-dev make tar && \ - cd /usr/include/dovecot && \ - patch -p1 < i_zero.patch && \ - rm /usr/include/dovecot/i_zero.patch && \ - mkdir /tmp/pigeonhole && \ - wget -qO- https://pigeonhole.dovecot.org/releases/2.2/dovecot-2.2-pigeonhole-0.4.18.tar.gz | tar -xz -C /tmp/pigeonhole --strip 1 && \ - cd /tmp/pigeonhole && \ - ./configure --with-ldap=yes --with-dovecot=/usr/lib/dovecot && \ - make && make install && \ - rm -r /tmp/pigeonhole && \ - apk del g++ openldap-dev dovecot-dev make tar +RUN apk --no-cache add \ + libsodium \ + lua -WORKDIR / - -RUN addgroup -g 2222 access -RUN addgroup dovecot access +RUN addgroup -g 2222 dovecot +RUN adduser -u 2222 -h /home/dovecot -D -G dovecot dovecot RUN addgroup -g 1111 vmail RUN adduser -u 1111 -h /var/lib/vmail -D -G vmail vmail -RUN mkdir /var/lib/vmail/sieve-after/ -RUN chown vmail:vmail /var/lib/vmail/sieve-after/ - EXPOSE 143 4190 6334 7777 VOLUME /var/lib/vmail/mail/ /etc/ssl/mail diff --git a/i_zero.patch b/i_zero.patch deleted file mode 100644 index ecef32e..0000000 --- a/i_zero.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/macros.h b/macros.h -index 566c176..ebbf480 100644 ---- a/macros.h -+++ b/macros.h -@@ -240,4 +240,7 @@ - # define STATIC_ARRAY - #endif - -+#define i_zero(p) memset(p, 0, sizeof(*(p))) -+#define i_zero_safe(p) safe_memset(p, 0, sizeof(*(p))) -+ - #endif