docker: Move rustup and cargo component lists into vars.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-05-14 04:05:08 +00:00
parent 0463b962fd
commit 2b67de9fc3
2 changed files with 20 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ ARG RUSTUP_HOME
ARG CARGO_HOME
ARG CARGO_TARGET
ARG rustup_version="1.28.1"
ARG rustup_components
WORKDIR /opt
RUN \
@@ -37,8 +38,7 @@ RUN \
rustup component add \
--toolchain ${rust_toolchain} \
--target ${CARGO_TARGET} \
clippy \
rustfmt \
${rustup_components} \
;
EOF
@@ -48,6 +48,7 @@ ARG rust_toolchain
ARG RUSTUP_HOME
ARG CARGO_HOME
ARG CARGO_TARGET
ARG cargo_installs
RUN \
--mount=type=cache,dst=${RUSTUP_HOME},sharing=locked \
@@ -58,11 +59,6 @@ RUN \
cargo install \
--locked \
--target ${CARGO_TARGET} \
cargo-chef \
cargo-audit \
cargo-deb \
cargo-arch \
cargo-generate-rpm \
lychee \
${cargo_installs} \
;
EOF

View File

@@ -1279,6 +1279,20 @@ group "buildsys" {
]
}
rustup_components = [
"clippy",
"rustfmt",
]
cargo_installs = [
"cargo-chef",
"cargo-audit",
"cargo-deb",
"cargo-arch",
"cargo-generate-rpm",
"lychee",
]
#
# Rust build environment
#
@@ -1318,6 +1332,8 @@ target "cookware" {
CARGO_HOME = "/opt/${sys_name}/${sys_target}/cargo"
CARGO_TARGET = rust_target
CARGO_TERM_VERBOSE = CARGO_TERM_VERBOSE
cargo_installs = join(" ", cargo_installs)
rustup_components = join(" ", rustup_components)
}
}