Fix dev compose: npm install on container startup

The ./server bind mount overwrites /app/server including node_modules
installed during the Docker build. Running npm install on startup
ensures deps are present after the volume mount.

Also reverts the node_modules named-volume workaround in favor of
this cleaner approach (requires node installed locally for non-Docker dev).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 19:27:52 -04:00
parent e98abe632a
commit 3d41c623bc
4 changed files with 3118 additions and 7 deletions

View File

@@ -18,7 +18,13 @@
"Bash(docker --version)", "Bash(docker --version)",
"Bash(docker compose:*)", "Bash(docker compose:*)",
"Bash(docker build:*)", "Bash(docker build:*)",
"Bash(docker run:*)" "Bash(docker run:*)",
"Bash(export PATH=\"/home/christian/.nvm/versions/node/v24.14.0/bin:$PATH\")",
"Bash(npm install:*)",
"Bash(npm run:*)",
"Bash(/home/christian/.nvm/versions/node/v24.14.0/bin/npm run:*)",
"Bash(PATH=\"/home/christian/.nvm/versions/node/v24.14.0/bin:$PATH\" npm run build 2>&1)",
"Bash(PATH=\"/home/christian/.nvm/versions/node/v24.14.0/bin:$PATH\" npx vite build 2>&1)"
] ]
} }
} }

1719
client/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,14 +2,9 @@ services:
app: app:
volumes: volumes:
- ./server:/app/server - ./server:/app/server
- server_node_modules:/app/server/node_modules
- ./client:/app/client - ./client:/app/client
- client_node_modules:/app/client/node_modules
ports: ports:
- "5173:5173" - "5173:5173"
environment: environment:
NODE_ENV: development NODE_ENV: development
command: sh -c "npm install && node src/index.js"
volumes:
server_node_modules:
client_node_modules:

1391
server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff