Isolate Nx cache in Docker with dedicated volume#382
Open
cteyton wants to merge 3 commits into
Open
Conversation
Mask /packmind/.nx in every container that bind-mounts the repo with a new dev-nx named volume, mirroring the existing dev-dist/dev-tmp/ dev-node_modules pattern. Containers (Linux/Alpine) then share one nx store among themselves while the host keeps its own .nx/ for local nx runs, avoiding cross-OS cache/graph contamination. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01559xduNDjnWKxCfXXY4Qmf
The migrate/downgrade scripts' "clean nx state" step (docker compose down + nx reset + rm -rf .nx) only clears the host store now. Add a line to each that also drops the containers' dev-nx volume (filtered by suffix since COMPOSE_PROJECT_NAME prefixes it). Document the dev-nx isolation and its reset one-liner in CONTRIBUTING.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01559xduNDjnWKxCfXXY4Qmf
Contributor
Greptile SummaryThis PR isolates Docker Nx state from the host checkout. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(dev): make dev-nx volume cleanup por..." | Re-trigger Greptile |
Address review feedback on the nx-volume cleanup:
- Drop `xargs -r`, which macOS/BSD xargs rejects ("illegal option -- r"),
causing the removal to silently skip and leave the stale dev-nx volume.
Capture the volume list into a variable and remove only when non-empty.
- Anchor the name filter to `dev-nx$` so it no longer also matches the
sibling dev-nx-sock volume (Docker's name filter is a regex).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01559xduNDjnWKxCfXXY4Qmf
Contributor
Author
|
@greptile update your review |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Explanation
This change isolates the Nx cache and project graph in Docker containers by introducing a dedicated
dev-nxDocker volume. This prevents Linux/Alpine containers and the host machine (e.g., macOS) from sharing and corrupting the same Nx store, which can occur due to platform differences.The changes include:
dev-nxvolume to all relevant services indocker-compose.ymldev-nxvolume in the volumes sectionCONTRIBUTING.mdType of Change
Affected Components
Testing
No testing needed. This is a Docker configuration enhancement that:
The change is straightforward configuration and documentation updates with no code logic changes.
TODO List
Reviewer Notes
The implementation adds the
dev-nx:/packmind/.nxvolume mount to 6 services:nx-cloudapicliapi-buildapi-build-prodapi-build-prod-arm64Both migration scripts (
downgrade_node22.shandmigrate_node24.sh) have been updated to clean up this volume during version transitions, ensuring a fresh Nx state after Node.js upgrades.https://claude.ai/code/session_01559xduNDjnWKxCfXXY4Qmf