fix(hooks): mount cargo target outside bind mount via CARGO_TARGET_DIR #49
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
Change the
pre-commitrecipe injustfileso the cargo target cache is mounted at/cargo-target(outside the/buildbind mount) and cargo is pointed at it via--env CARGO_TARGET_DIR=/cargo-target, instead of nesting thedev-monkey-cargo-targetnamed volume at/build/target. The volume name is unchanged; only its mount path moves.Why (DEV-371)
Nesting the named volume at
/build/target(inside the$PWD:/buildbind mount) makes the Docker daemon materialize a root-owned./targetdirectory on the host, which then needssudoto remove. Moving the mount off the bind mount eliminates the stray root-owned directory while keeping the build cache persistent in the named volume.This follows the governance Option A standard: mount the cache outside the bind mount and set
CARGO_TARGET_DIR.