From a489b4c1139b28b8d87bbbb4f7661490ea70ff9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bojan=20=C4=8Cekrli=C4=87?= Date: Mon, 6 Sep 2021 11:25:10 +0200 Subject: [PATCH] Move build of sasl-xoauth2 to the main file Some users have reported issues with GCE and how sasl-xoauth2 was built. Moving the building process back into the main part of the `Dockerfile` should hopefully prevent similar issues. --- Dockerfile | 58 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6b26b7b..0b8931f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,11 @@ ARG BASE_IMAGE=alpine:latest # ARG BASE_IMAGE=ubuntu:focal -# ============================ BUILD SASL XOAUTH2 ============================ -FROM ${BASE_IMAGE} as build -ARG SASL_XOAUTH2_REPO_URL=https://github.com/tarickb/sasl-xoauth2.git -ARG SASL_XOAUTH2_GIT_REF=release-0.10 - -RUN true && \ - if [ -f /etc/alpine-release ]; then \ - apk add --no-cache --upgrade git && \ - apk add --no-cache --upgrade cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev; \ - else \ - export DEBIAN_FRONTEND=noninteractive && \ - echo "Europe/Berlin" > /etc/timezone && \ - apt-get update -y -qq && \ - apt-get install -y git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev; \ - fi -RUN git clone --depth 1 --branch ${SASL_XOAUTH2_GIT_REF} ${SASL_XOAUTH2_REPO_URL} /sasl-xoauth2 -RUN true && \ - cd /sasl-xoauth2 && \ - mkdir build && \ - cd build && \ - cmake -DCMAKE_INSTALL_PREFIX=/ .. && \ - make - -# ============================ BUILD SASL XOAUTH2 ============================ FROM ${BASE_IMAGE} LABEL maintainer="Bojan Cekrlic - https://github.com/bokysan/docker-postfix/" +# ============================ INSTALL BASIC SERVICES ============================ + # Install supervisor, postfix # Install postfix first to get the first account (101) # Install opendkim second to get the second account (102) @@ -49,8 +27,36 @@ RUN true && \ fi && \ cp -r /etc/postfix /etc/postfix.template -# Copy SASL-XOAUTH2 plugin -COPY --from=build /sasl-xoauth2/build/src/libsasl-xoauth2.so /usr/lib/sasl2/ +# ============================ BUILD SASL XOAUTH2 ============================ + +ARG SASL_XOAUTH2_REPO_URL=https://github.com/tarickb/sasl-xoauth2.git +ARG SASL_XOAUTH2_GIT_REF=release-0.10 + +RUN true && \ + if [ -f /etc/alpine-release ]; then \ + apk add --no-cache --upgrade --virtual .build-deps git cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev; \ + else \ + export DEBIAN_FRONTEND=noninteractive && \ + echo "Europe/Berlin" > /etc/timezone && \ + apt-get update -y -qq && \ + apt-get install -y --no-install-recommends git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev; \ + fi && \ + git clone --depth 1 --branch ${SASL_XOAUTH2_GIT_REF} ${SASL_XOAUTH2_REPO_URL} /sasl-xoauth2 && \ + cd /sasl-xoauth2 && \ + mkdir build && \ + cd build && \ + cmake -DCMAKE_INSTALL_PREFIX=/ .. && \ + make && \ + make install && \ + if [ -f /etc/alpine-release ]; then \ + apk del .build-deps; \ + else \ + apt-get remove --purge -y git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev; \ + apt-get autoremove --yes; apt-get clean autoclean; \ + rm -rf /var/lib/apt/lists/*; \ + fi && \ + cd / && rm -rf /sasl-xoauth2 + # Set up configuration COPY /configs/supervisord.conf /etc/supervisord.conf