summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2024-04-19 13:26:04 +0200
committerLinus Färnstrand <linus@mullvad.net>2025-02-04 14:22:55 +0100
commit255e428a59fe8e18b8dfc009feea9d78db9321ad (patch)
treecf95abe07d7d979ee5f08d2a4164255d0a0aaf76
parenta80feea09e0652842bc8e9d27014e0f4d6d867a1 (diff)
downloadmullvadvpn-255e428a59fe8e18b8dfc009feea9d78db9321ad.tar.xz
mullvadvpn-255e428a59fe8e18b8dfc009feea9d78db9321ad.zip
Make container build script pick up correct Rust version
-rw-r--r--building/Dockerfile6
-rwxr-xr-xbuilding/build-and-publish-container-image.sh3
2 files changed, 7 insertions, 2 deletions
diff --git a/building/Dockerfile b/building/Dockerfile
index 07018b6cd9..31208fa3b6 100644
--- a/building/Dockerfile
+++ b/building/Dockerfile
@@ -54,11 +54,13 @@ RUN dpkg --add-architecture arm64 && apt-get update -y && apt-get install -y \
# === Rust ===
-# Install latest stable Rust toolchain for both x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu,
+ARG RUST_VERSION=stable
+
+# Install the Rust toolchain for both x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu,
# plus x86_64-pc-windows-gnu for Windows cross-compilation/linting
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y \
- --default-toolchain stable \
+ --default-toolchain $RUST_VERSION \
--profile minimal \
--component clippy \
--target aarch64-unknown-linux-gnu \
diff --git a/building/build-and-publish-container-image.sh b/building/build-and-publish-container-image.sh
index 4ed02af816..8fd78b6365 100755
--- a/building/build-and-publish-container-image.sh
+++ b/building/build-and-publish-container-image.sh
@@ -35,8 +35,11 @@ case ${1-:""} in
esac
full_container_name="$REGISTRY_HOST/$REGISTRY_ORG/$container_name"
+RUST_VERSION=$(rg -o "channel = \"(.*)\"" -r '$1' "$REPO_DIR/rust-toolchain.toml")
+
log_header "Building $full_container_name tagged as '$tag' and 'latest'"
podman build -f "$containerfile_path" "$container_context_dir" --no-cache \
+ --build-arg="RUST_VERSION=$RUST_VERSION" \
-t "$full_container_name:$tag" \
-t "$full_container_name:latest"