Don't include the target/ directory in the Docker build layers

This commit is contained in:
Quentin Gliech
2025-03-24 17:24:05 +01:00
parent 976dd898c7
commit bcce0af7ea

View File

@@ -114,20 +114,18 @@ ENV VERGEN_GIT_DESCRIBE=${VERGEN_GIT_DESCRIBE}
# Network access: cargo auditable needs it # Network access: cargo auditable needs it
RUN --network=default \ RUN --network=default \
--mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/app/target \
cargo auditable build \ cargo auditable build \
--locked \ --locked \
--release \ --release \
--bin mas-cli \ --bin mas-cli \
--no-default-features \ --no-default-features \
--features docker \ --features docker \
--target x86_64-unknown-linux-gnu \ --target x86_64-unknown-linux-gnu \
--target aarch64-unknown-linux-gnu --target aarch64-unknown-linux-gnu \
&& mv "target/x86_64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli-amd64 \
# Move the binary to avoid having to guess its name in the next stage && mv "target/aarch64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli-arm64
RUN --network=none \
mv "target/x86_64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli-amd64
RUN --network=none \
mv "target/aarch64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli-arm64
####################################### #######################################
## Prepare /usr/local/share/mas-cli/ ## ## Prepare /usr/local/share/mas-cli/ ##