diff --git a/images/Dockerfile.bottlecap.alpine.compile b/images/Dockerfile.bottlecap.alpine.compile index 42e5888a8..ac854146f 100644 --- a/images/Dockerfile.bottlecap.alpine.compile +++ b/images/Dockerfile.bottlecap.alpine.compile @@ -33,7 +33,9 @@ WORKDIR /tmp/dd/bottlecap RUN --mount=type=cache,target=/root/.cargo/git \ --mount=type=cache,target=/root/.cargo/registry \ --mount=type=bind,source=.,target=/tmp/dd,rw \ - --mount=type=cache,target=/tmp/dd/bottlecap/target \ + # sharing=private gives each concurrent build its own target cache instead of + # blocking on cargo's build-directory lock while waiting for a shared mount + --mount=type=cache,sharing=private,target=/tmp/dd/bottlecap/target \ if [ "${FIPS}" = "1" ]; then \ export FEATURES=fips; \ if [ "${PLATFORM}" = "aarch64" ]; then \ diff --git a/images/Dockerfile.bottlecap.compile b/images/Dockerfile.bottlecap.compile index 604026a38..877e6e21e 100644 --- a/images/Dockerfile.bottlecap.compile +++ b/images/Dockerfile.bottlecap.compile @@ -34,7 +34,9 @@ WORKDIR /tmp/dd/bottlecap RUN --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=bind,source=.,target=/tmp/dd,rw \ - --mount=type=cache,target=/tmp/dd/bottlecap/target \ + # sharing=private gives each concurrent build its own target cache instead of + # blocking on cargo's build-directory lock while waiting for a shared mount + --mount=type=cache,sharing=private,target=/tmp/dd/bottlecap/target \ if [ "${FIPS}" = "1" ]; then \ export FEATURES=fips; \ else \