docker: Share the target deps and build caches globally.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk committed 2025-05-31 10:36:39 +00:00
1 parent c1c4ce9679
commit 3c02faa532
6 files changed
+26 -10

No files matched your search

+5 -2
View File
@@ -7,6 +7,7 @@ ARG RUSTUP_HOME
ARG CARGO_HOME
ARG CARGO_TARGET
ARG CARGO_TARGET_DIR
ARG CARGO_TARGET_CACHE
ARG cargo_profile
ARG cargo_features
ARG cargo_spec_features
@@ -26,8 +27,10 @@ RUN \
--mount=type=cache,dst=${RUSTUP_HOME},sharing=locked \
--mount=type=cache,dst=${CARGO_HOME},sharing=locked \
--mount=type=cache,dst=${CARGO_TARGET_DIR},sharing=locked \
--mount=type=cache,dst=${CARGO_TARGET_DIR}/deps,sharing=shared \
--mount=type=cache,dst=${CARGO_TARGET_DIR}/build,sharing=shared \
--mount=type=cache,dst=${CARGO_TARGET_DIR}/deps,id=${CARGO_TARGET_CACHE}/deps,sharing=shared \
--mount=type=cache,dst=${CARGO_TARGET_DIR}/build,id=${CARGO_TARGET_CACHE}/build,sharing=shared \
--mount=type=cache,dst=${CARGO_TARGET_DIR}/incremental,id=${CARGO_TARGET_CACHE}/incremental,sharing=shared \
--mount=type=cache,dst=${CARGO_TARGET_DIR}/.fingerprint,id=${CARGO_TARGET_CACHE}/fingerprint,sharing=shared \
<<EOF
set -eux
case "$cargo_profile" in