fix(hooks): mount cargo target outside bind mount via CARGO_TARGET_DIR #53
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 named volume mounts at/cargo-target(outside the/buildbind mount) and cargo writes there viaCARGO_TARGET_DIR=/cargo-target, instead of nesting it at/build/target.Why (DEV-371)
Nesting the named volume under the
/buildbind mount makes the Docker daemon materialize a root-ownedtarget/directory on the host, which then needssudoto remove. Moving the mount off the bind mount keeps the host working tree clean. The build cache still persists in the unchangeddev-forgejo-cli-cargo-targetnamed volume.Governance Option A
Implements Option A: mount the cargo-target volume outside the bind mount and set
CARGO_TARGET_DIR, the canonical fix for the pre-commit root-owned-target class of issue.