From c3af526c6c2eda98b769f50e5c36de122c737c21 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Jul 2026 14:36:03 +0000 Subject: [PATCH 1/3] fix(docker): isolate container Nx state in a dev-nx named volume 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 Claude-Session: https://claude.ai/code/session_01559xduNDjnWKxCfXXY4Qmf --- docker-compose.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 244e9c1e2..839378375 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,7 @@ services: volumes: - .:/packmind - dev-node_modules:/packmind/node_modules + - dev-nx:/packmind/.nx - dev-nx-sock:/nx-sock environment: <<: *nx-env @@ -114,6 +115,7 @@ services: volumes: - .:/packmind - dev-node_modules:/packmind/node_modules + - dev-nx:/packmind/.nx - dev-corepack-cache:/root/.cache/node/corepack - dev-pnpm-store:/root/.local/share/pnpm @@ -137,6 +139,7 @@ services: volumes: - .:/packmind - dev-node_modules:/packmind/node_modules + - dev-nx:/packmind/.nx - dev-corepack-cache:/root/.cache/node/corepack - dev-pnpm-store:/root/.local/share/pnpm depends_on: @@ -177,6 +180,7 @@ services: volumes: - .:/packmind - dev-node_modules:/packmind/node_modules + - dev-nx:/packmind/.nx - dev-dist:/packmind/dist - dev-tmp:/packmind/tmp - dev-nx-sock:/nx-sock @@ -231,6 +235,7 @@ services: volumes: - .:/packmind - dev-node_modules:/packmind/node_modules + - dev-nx:/packmind/.nx - dev-dist:/packmind/dist - dev-tmp:/packmind/tmp - dev-nx-sock:/nx-sock @@ -276,6 +281,7 @@ services: volumes: - .:/packmind - dev-node_modules:/packmind/node_modules + - dev-nx:/packmind/.nx - dev-dist:/packmind/dist - dev-tmp:/packmind/tmp - dev-nx-sock:/nx-sock @@ -297,6 +303,7 @@ services: volumes: dev-nx-sock: + dev-nx: dev-postgres-data: dev-redis-data: dev-pgadmin: From 766f8ca4d70c2697cc73351c06a10981f44e97c5 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Jul 2026 14:36:34 +0000 Subject: [PATCH 2/3] docs(dev): update nx cleanup for the dev-nx volume 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 Claude-Session: https://claude.ai/code/session_01559xduNDjnWKxCfXXY4Qmf --- CONTRIBUTING.md | 12 ++++++++++++ downgrade_node22.sh | 2 ++ migrate_node24.sh | 2 ++ 3 files changed, 16 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 28a5c4fa9..3f3c996a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,18 @@ docker compose --profile=dev up The app should be available at [http://localhost:4200](http://localhost:4200) +> **Nx state in Docker:** the containers keep their Nx cache and project +> graph in a dedicated `dev-nx` Docker volume, isolated from the host's +> `.nx/` directory. This prevents the Linux/Alpine containers and your +> host (e.g. macOS) from sharing — and corrupting — the same Nx store. To +> reset only the containers' Nx state, run: +> +> ```shell +> docker volume ls -q --filter name=dev-nx | xargs -r docker volume rm -f +> ``` +> +> For a full reset (including the database), use `docker compose down -v`. + ## Migrating an existing checkout from npm to pnpm If you previously worked with npm, run the one-shot migration script from the diff --git a/downgrade_node22.sh b/downgrade_node22.sh index 480da3001..255084971 100755 --- a/downgrade_node22.sh +++ b/downgrade_node22.sh @@ -10,6 +10,8 @@ echo "⏹️ Arrêt des containers Docker..." docker compose down echo "🗑️ Suppression des volumes Docker dev-nx-sock et dev-node_modules..." docker volume rm dev-nx-sock dev-node_modules 2>/dev/null || true +echo "🗑️ Suppression du volume Nx des containers (dev-nx)..." +docker volume ls -q --filter name=dev-nx | xargs -r docker volume rm -f 2>/dev/null || true # 2. Reset Nx (tant que node_modules et .nx existent encore) echo "" diff --git a/migrate_node24.sh b/migrate_node24.sh index 3a28fc793..3d2433c51 100755 --- a/migrate_node24.sh +++ b/migrate_node24.sh @@ -10,6 +10,8 @@ echo "⏹️ Arrêt des containers Docker..." docker compose down echo "🗑️ Suppression des volumes Docker dev-nx-sock et dev-node_modules..." docker volume rm dev-nx-sock dev-node_modules 2>/dev/null || true +echo "🗑️ Suppression du volume Nx des containers (dev-nx)..." +docker volume ls -q --filter name=dev-nx | xargs -r docker volume rm -f 2>/dev/null || true # 2. Reset Nx (tant que node_modules et .nx existent encore) echo "" From ce8a0a7fe521d29bc1e40f27d4f3a7fdaeb016c6 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Jul 2026 14:47:32 +0000 Subject: [PATCH 3/3] fix(dev): make dev-nx volume cleanup portable and precise 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 Claude-Session: https://claude.ai/code/session_01559xduNDjnWKxCfXXY4Qmf --- CONTRIBUTING.md | 2 +- downgrade_node22.sh | 3 ++- migrate_node24.sh | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f3c996a7..c60d2fb6f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ The app should be available at [http://localhost:4200](http://localhost:4200) > reset only the containers' Nx state, run: > > ```shell -> docker volume ls -q --filter name=dev-nx | xargs -r docker volume rm -f +> docker volume ls -q --filter name='dev-nx$' | xargs docker volume rm -f > ``` > > For a full reset (including the database), use `docker compose down -v`. diff --git a/downgrade_node22.sh b/downgrade_node22.sh index 255084971..c7c32d621 100755 --- a/downgrade_node22.sh +++ b/downgrade_node22.sh @@ -11,7 +11,8 @@ docker compose down echo "🗑️ Suppression des volumes Docker dev-nx-sock et dev-node_modules..." docker volume rm dev-nx-sock dev-node_modules 2>/dev/null || true echo "🗑️ Suppression du volume Nx des containers (dev-nx)..." -docker volume ls -q --filter name=dev-nx | xargs -r docker volume rm -f 2>/dev/null || true +nx_volumes="$(docker volume ls -q --filter name='dev-nx$')" +[ -n "$nx_volumes" ] && docker volume rm -f $nx_volumes 2>/dev/null || true # 2. Reset Nx (tant que node_modules et .nx existent encore) echo "" diff --git a/migrate_node24.sh b/migrate_node24.sh index 3d2433c51..8c0392f05 100755 --- a/migrate_node24.sh +++ b/migrate_node24.sh @@ -11,7 +11,8 @@ docker compose down echo "🗑️ Suppression des volumes Docker dev-nx-sock et dev-node_modules..." docker volume rm dev-nx-sock dev-node_modules 2>/dev/null || true echo "🗑️ Suppression du volume Nx des containers (dev-nx)..." -docker volume ls -q --filter name=dev-nx | xargs -r docker volume rm -f 2>/dev/null || true +nx_volumes="$(docker volume ls -q --filter name='dev-nx$')" +[ -n "$nx_volumes" ] && docker volume rm -f $nx_volumes 2>/dev/null || true # 2. Reset Nx (tant que node_modules et .nx existent encore) echo ""