fix: improve devcontainer configuration based on review

- Fix PATH handling to avoid host PATH injection
- Configure pnpm store directory to use mounted volume
- Remove redundant node_modules volume mounts
- Remove WORKDIR directive to use Dev Container defaults
This commit is contained in:
Roo Code 2025-11-02 11:33:33 +00:00
parent 62e5d4de63
commit 50179a5f69
2 changed files with 5 additions and 11 deletions

View file

@ -34,7 +34,4 @@ RUN mkdir -p /pnpm /workspace \
&& chown -R $USERNAME:$USERNAME /pnpm /workspace
# Switch to non-root user
USER $USERNAME
# Set the working directory
WORKDIR /workspace
USER $USERNAME

View file

@ -40,7 +40,7 @@
"forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created
"postCreateCommand": "pnpm install --frozen-lockfile",
"postCreateCommand": "pnpm config set store-dir /pnpm/store && pnpm install --frozen-lockfile",
// Use 'postStartCommand' to run commands after the container starts
"postStartCommand": "echo '🎉 Dev container is ready!'",
@ -49,16 +49,13 @@
"mounts": [
// Mount pnpm store as a volume for caching
"source=pnpm-store,target=/pnpm,type=volume",
// Mount node_modules as volumes for better performance
"source=node-modules,target=/workspace/node_modules,type=volume",
"source=src-node-modules,target=/workspace/src/node_modules,type=volume",
"source=webview-ui-node-modules,target=/workspace/webview-ui/node_modules,type=volume"
// Mount root node_modules as volume for better performance
"source=node-modules,target=/workspace/node_modules,type=volume"
],
// Environment variables
"containerEnv": {
"PNPM_HOME": "/pnpm",
"PATH": "/pnpm:${localEnv:PATH}"
"PNPM_HOME": "/pnpm"
},
// Run as non-root user