From 437fb8bdb5eb47429a1055e51f6c4e6c95ad9bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bojan=20=C4=8Cekrli=C4=87?= Date: Sat, 1 Mar 2025 18:57:14 +0100 Subject: [PATCH] Fix: Do not install rust on mips64el --- Dockerfile | 2 +- build-scripts/sasl-build.sh | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f260c10..4019faa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=var-cache- --mount=type=tmpfs,target=/tmp \ --mount=type=tmpfs,target=/sasl-xoauth2 \ --mount=type=bind,from=build-scripts,source=/build-scripts,target=/build-scripts \ - sh /build-scripts/sasl-build.sh + bash /build-scripts/sasl-build.sh # ============================ Prepare main image ============================ FROM sasl diff --git a/build-scripts/sasl-build.sh b/build-scripts/sasl-build.sh index f491fa5..7d41712 100644 --- a/build-scripts/sasl-build.sh +++ b/build-scripts/sasl-build.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -e +local arch="$(uname -m)" + # Build the sasl2 library with the sasl-xoauth2 plugin. # # The sasl-xoauth2 plugin is a SASL plugin that provides support for XOAUTH2 (OAuth 2.0) authentication. @@ -46,9 +48,11 @@ build_sasl2() { # (because they don't exist in the PIP repositories) and "pip install" will fail without rust. Specifically, when # compiling cryptographic libraries. setup_rust() { - curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal - export PATH="$HOME/.cargo/bin:$PATH" - . "$HOME/.cargo/env" + if [[ "${arch}"!= "386" ]] && [[ "${arch}"!= "i386" ]] && [[ "${arch}"!= "mips64el" ]]; then + curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal + export PATH="$HOME/.cargo/bin:$PATH" + . "$HOME/.cargo/env" + fi } # Create a virtual environment and install the msal library for the @@ -56,7 +60,7 @@ setup_rust() { setup_python_venv() { python3 -m venv /sasl . /sasl/bin/activate - if [[ "$(uname -m)"!= "386" ]] && [[ "$(uname -m)"!= "i386" ]]; then + if [[ "${arch}"!= "386" ]] && [[ "${arch}"!= "i386" ]] && [[ "${arch}"!= "mips64el" ]]; then pip3 install msal fi } @@ -96,7 +100,9 @@ else # Run compilation and installation setup_rust base_install - rustup self uninstall -y + if [[ "${arch}"!= "386" ]] && [[ "${arch}"!= "i386" ]] && [[ "${arch}"!= "mips64el" ]]; then + rustup self uninstall -y + fi # Cleanup. This is important to ensure that we don't keep unnecessary files laying around and thus increasing the size of the image. apt-get remove --purge -y ${LIBS} python3-venv