|
| 1 | +{ |
| 2 | + // Display name shown by editor when selecting this dev container |
| 3 | + "name": "${localWorkspaceFolderBasename} Dev Environment", |
| 4 | + |
| 5 | + // Base image from Microsoft devcontainers for a TypeScript + Node environment |
| 6 | + "image": "mcr.microsoft.com/devcontainers/typescript-node", |
| 7 | + |
| 8 | + // Persisted volumes to speed installs and preserve build artifacts between container restarts |
| 9 | + "mounts": [ |
| 10 | + // Persist node_modules so reinstalling or rebuilding the container doesn't force repeated network installs |
| 11 | + "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", |
| 12 | + |
| 13 | + // Persist built outputs (dist) to avoid losing compiled artifacts across container restarts |
| 14 | + "source=${localWorkspaceFolderBasename}-dist,target=${containerWorkspaceFolder}/dist,type=volume", |
| 15 | + |
| 16 | + // Share a pnpm store cache volume to speed package resolution and install times across projects/containers |
| 17 | + "source=pnpm-cache,target=${containerWorkspaceFolder}/.pnpm-store,type=volume" |
| 18 | + ], |
| 19 | + |
| 20 | + // Run once after the container filesystem is created. |
| 21 | + // - Fix ownership so the non-root node user can access workspace files |
| 22 | + // - Install latest pnpm globally so postStartCommand and developer workflows use pnpm |
| 23 | + "postCreateCommand": "sudo chown node -R . /home && npm install -g pnpm@latest", |
| 24 | + |
| 25 | + // Run each time the container starts. Ensures dependencies are installed inside the container user environment. |
| 26 | + "postStartCommand": "pnpm install --frozen-lockfile", |
| 27 | + |
| 28 | + // Use the non-root 'node' user provided by the base image for safer file access and to mirror deployment permissions |
| 29 | + "remoteUser": "node", |
| 30 | + |
| 31 | + "customizations": { |
| 32 | + "vscode": { |
| 33 | + // Recommended and enforced editor settings for consistent linting/validation across contributors |
| 34 | + "settings": { |
| 35 | + // Prefer editor config over global formatting where appropriate |
| 36 | + "editor.formatOnSave": true, |
| 37 | + "editor.codeActionsOnSave": { |
| 38 | + "source.fixAll.eslint": "explicit" |
| 39 | + }, |
| 40 | + "eslint.validate": [ |
| 41 | + "json", |
| 42 | + "javascript", |
| 43 | + "javascriptreact", |
| 44 | + "typescript", |
| 45 | + "typescriptreact" |
| 46 | + ], |
| 47 | + // Disable telemetry to avoid sending usage data to Microsoft |
| 48 | + "telemetry.enableTelemetry": false |
| 49 | + }, |
| 50 | + |
| 51 | + // Recommended extensions preinstalled in the container to provide a consistent developer experience |
| 52 | + "extensions": [ |
| 53 | + "streetsidesoftware.code-spell-checker", // basic spell checking in docs/comments |
| 54 | + "bradlc.vscode-tailwindcss", // Tailwind CSS IntelliSense if project uses Tailwind |
| 55 | + "dbaeumer.vscode-eslint", // ESLint integration for linting and autofix |
| 56 | + "esbenp.prettier-vscode", // Prettier for consistent formatting |
| 57 | + "yoavbls.pretty-ts-errors", // Improved TypeScript error messages |
| 58 | + "davidanson.vscode-markdownlint", // Markdown linting for docs |
| 59 | + "github.vscode-github-actions", // GitHub Actions workflow support |
| 60 | + "github.vscode-pull-request-github" // PR and issue integration with GitHub |
| 61 | + ] |
| 62 | + } |
| 63 | + } |
| 64 | +} |
0 commit comments