Skip to content

Commit 50179a5

Browse files
committed
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
1 parent 62e5d4d commit 50179a5

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,4 @@ RUN mkdir -p /pnpm /workspace \
3434
&& chown -R $USERNAME:$USERNAME /pnpm /workspace
3535

3636
# Switch to non-root user
37-
USER $USERNAME
38-
39-
# Set the working directory
40-
WORKDIR /workspace
37+
USER $USERNAME

.devcontainer/devcontainer.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"forwardPorts": [],
4141

4242
// Use 'postCreateCommand' to run commands after the container is created
43-
"postCreateCommand": "pnpm install --frozen-lockfile",
43+
"postCreateCommand": "pnpm config set store-dir /pnpm/store && pnpm install --frozen-lockfile",
4444

4545
// Use 'postStartCommand' to run commands after the container starts
4646
"postStartCommand": "echo '🎉 Dev container is ready!'",
@@ -49,16 +49,13 @@
4949
"mounts": [
5050
// Mount pnpm store as a volume for caching
5151
"source=pnpm-store,target=/pnpm,type=volume",
52-
// Mount node_modules as volumes for better performance
53-
"source=node-modules,target=/workspace/node_modules,type=volume",
54-
"source=src-node-modules,target=/workspace/src/node_modules,type=volume",
55-
"source=webview-ui-node-modules,target=/workspace/webview-ui/node_modules,type=volume"
52+
// Mount root node_modules as volume for better performance
53+
"source=node-modules,target=/workspace/node_modules,type=volume"
5654
],
5755

5856
// Environment variables
5957
"containerEnv": {
60-
"PNPM_HOME": "/pnpm",
61-
"PATH": "/pnpm:${localEnv:PATH}"
58+
"PNPM_HOME": "/pnpm"
6259
},
6360

6461
// Run as non-root user

0 commit comments

Comments
 (0)