diff --git a/build/Dockerfile b/build/Dockerfile index 3b8a12c2..cb947b15 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,5 +1,8 @@ # Builds release binaries for Radicle. -FROM rust:1.80-alpine3.20 as builder +ARG RUST_VERSION="1.85" +ARG ALPINE_VERSION="3.20" + +FROM rust:${RUST_VERSION}-alpine${ALPINE_VERSION} as builder LABEL maintainer="Radicle Team " WORKDIR /src COPY . . diff --git a/build/build b/build/build index dc82efe0..7baffb54 100755 --- a/build/build +++ b/build/build @@ -27,6 +27,7 @@ main() { keypath="$(rad path)/keys/radicle.pub" version="$(build/version)" image=radicle-build-$version + rust_version="$(build/rust-version)" if [ ! -f "$keypath" ]; then echo "fatal: no key found at $keypath" >&2 ; exit 1 @@ -40,6 +41,7 @@ main() { echo "Building image ($image).." podman --cgroup-manager=cgroupfs build \ + --build-arg "RUST_VERSION=$rust_version" \ --build-arg SOURCE_DATE_EPOCH \ --build-arg TZ \ --build-arg LC_ALL \ diff --git a/build/rust-version b/build/rust-version new file mode 100755 index 00000000..4f02b123 --- /dev/null +++ b/build/rust-version @@ -0,0 +1,7 @@ +#!/bin/sh + +if ! version=$(grep -m 1 -oP "channel\s*=\s*\K(.*)" rust-toolchain.toml); then + echo "fatal: no rust version found via rust-toolchain.toml" >&2 ; exit 1 +fi + +echo "$version"