fix(hooks): mount cargo target outside bind mount via CARGO_TARGET_DIR #40
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/dev-371-precommit-host-owned-target"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Mount the cargo target cache at
/cargo-target(outside the/buildbind mount) in every cargo step of thepre-commitrecipe, and point cargo at it with--env CARGO_TARGET_DIR=/cargo-target, instead of nesting the named volume at/build/target. The volume name (dev-vervain-apps-cargo-target) and the registry volume are unchanged.Why (DEV-371)
Nesting a named volume at
/build/target(inside the$PWD:/buildbind mount) makes the Docker daemon materialize a root-ownedtarget/directory on the host, which then needssudoto remove. Moving the cache mount outside the bind mount keeps the host tree clean while the cache still persists in the named volume.The bun/tailwind (
build-css) step already runs with--user $(id -u):(id -g), so its generated files are already host-owned and that step is left untouched.Aligns with the governance Option A standard.