mirror of
https://github.com/bokysan/docker-postfix.git
synced 2025-09-05 22:14:26 +08:00
Fix for installation of msal library
This will create a python venv and point sasl-xoauth2-tool to use this venv. This way, when the user executes the command, it will "automagically" work instead of failing.
This commit is contained in:
parent
3b2d8db991
commit
50c95039c4
3 changed files with 49 additions and 31 deletions
|
@ -34,8 +34,6 @@ ARG TARGETPLATFORM
|
||||||
ARG SASL_XOAUTH2_REPO_URL=https://github.com/tarickb/sasl-xoauth2.git
|
ARG SASL_XOAUTH2_REPO_URL=https://github.com/tarickb/sasl-xoauth2.git
|
||||||
ARG SASL_XOAUTH2_GIT_REF=release-0.25
|
ARG SASL_XOAUTH2_GIT_REF=release-0.25
|
||||||
|
|
||||||
# --mount=type=cache,target=/var/cache/apk,sharing=locked,id=var-cache-apk-$TARGETPLATFORM \
|
|
||||||
# --mount=type=cache,target=/etc/apk/cache,sharing=locked,id=etc-apk-cache-$TARGETPLATFORM \
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=var-cache-apt-$TARGETPLATFORM \
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=var-cache-apt-$TARGETPLATFORM \
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=var-lib-apt-$TARGETPLATFORM \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=var-lib-apt-$TARGETPLATFORM \
|
||||||
--mount=type=tmpfs,target=/etc/apk/cache \
|
--mount=type=tmpfs,target=/etc/apk/cache \
|
||||||
|
|
|
@ -1,40 +1,53 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
build_sasl2() {
|
build_sasl2() {
|
||||||
git clone --depth 1 --branch ${SASL_XOAUTH2_GIT_REF} ${SASL_XOAUTH2_REPO_URL} /sasl-xoauth2
|
git clone --depth 1 --branch ${SASL_XOAUTH2_GIT_REF} ${SASL_XOAUTH2_REPO_URL} /sasl-xoauth2
|
||||||
cd /sasl-xoauth2
|
cd /sasl-xoauth2
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
# Documentation build (now) requires pandoc, which is not available on multiple
|
# Documentation build (now) requires pandoc, which is not available on multiple
|
||||||
# architectures. Since we're are building an image that we want it to be as slim as possible,
|
# architectures. Since we're are building an image that we want it to be as slim as possible,
|
||||||
# we're removing the build of documentation instead of complicating things with pandoc.
|
# we're removing the build of documentation instead of complicating things with pandoc.
|
||||||
patch -p1 -d .. < /build-scripts/sasl-xoauth2-01.patch
|
patch -p1 -d .. < /build-scripts/sasl-xoauth2-01.patch
|
||||||
if [ -f /etc/alpine-release ]; then
|
|
||||||
patch -p1 -d .. < /build-scripts/sasl-xoauth2-02.patch
|
# Ensure that the sasl-xoauth2-tool uses python from the virtual environment into which we
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=/ ..
|
# installed the msal library.
|
||||||
else
|
patch -p1 -d .. < /build-scripts/sasl-xoauth2-03.patch
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
|
|
||||||
fi
|
if [ -f /etc/alpine-release ]; then
|
||||||
make
|
patch -p1 -d .. < /build-scripts/sasl-xoauth2-02.patch
|
||||||
make install
|
cmake -DCMAKE_INSTALL_PREFIX=/ ..
|
||||||
install ../scripts/postfix-sasl-xoauth2-update-ca-certs /etc/ca-certificates/update.d
|
else
|
||||||
update-ca-certificates
|
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
|
||||||
|
fi
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
install ../scripts/postfix-sasl-xoauth2-update-ca-certs /etc/ca-certificates/update.d
|
||||||
|
update-ca-certificates
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_python_venv() {
|
||||||
|
python3 -m venv /sasl
|
||||||
|
. /sasl/bin/activate
|
||||||
|
pip3 install msal
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -f /etc/lsb-release ] && . /etc/lsb-release
|
[ -f /etc/lsb-release ] && . /etc/lsb-release
|
||||||
[ -f /etc/os-release ] && . /etc/os-release
|
[ -f /etc/os-release ] && . /etc/os-release
|
||||||
if [ -f /etc/alpine-release ]; then
|
if [ -f /etc/alpine-release ]; then
|
||||||
apk add --upgrade --virtual .build-deps git cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev patch
|
apk add --upgrade --virtual .build-deps git cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev patch
|
||||||
build_sasl2
|
setup_python_venv
|
||||||
apk del .build-deps;
|
build_sasl2
|
||||||
|
apk del .build-deps;
|
||||||
else
|
else
|
||||||
apt-get update -y -qq
|
apt-get update -y -qq
|
||||||
LIBS="git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev"
|
LIBS="git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev python3-venv"
|
||||||
apt-get install -y --no-install-recommends ${LIBS}
|
apt-get install -y --no-install-recommends ${LIBS}
|
||||||
build_sasl2
|
setup_python_venv
|
||||||
apt-get remove --purge -y ${LIBS}
|
build_sasl2
|
||||||
apt-get autoremove --yes
|
apt-get remove --purge -y ${LIBS}
|
||||||
apt-get clean autoclean
|
apt-get autoremove --yes
|
||||||
|
apt-get clean autoclean
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
7
build-scripts/sasl-xoauth2-03.patch
Normal file
7
build-scripts/sasl-xoauth2-03.patch
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
--- sasl-xoauth2-orig/scripts/sasl-xoauth2-tool.in 2025-03-01 08:38:07
|
||||||
|
+++ sasl-xoauth2/scripts/sasl-xoauth2-tool.in 2025-03-01 08:38:12
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/python3
|
||||||
|
+#!/sasl/bin/python3
|
||||||
|
# PYTHON_ARGCOMPLETE_OK
|
||||||
|
# -*- coding: utf-8 -*-
|
Loading…
Add table
Reference in a new issue