|
1 | | -// For format details, see https://aka.ms/devcontainer.json. For config options, see the |
2 | | -// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node |
| 1 | +// Instructions to use this devcontainer: |
| 2 | +// 0. Make sure Docker or Podman is running. |
| 3 | +// 1. Install the VS Code extension "Dev Containers" (ms-vscode-remote.remote-containers). |
| 4 | +// 2. Open the Command Palette (Shift+Ctrl+P / Shift+Cmd+P) and run "Dev Containers: Reopen in Container", |
| 5 | +// alternatively "Dev Containers: Open Folder in Container". |
| 6 | +// 3. When finished, run "Dev Containers: Close Remote Connection" from the Command Palette to stop the container. |
| 7 | +// 4. To reclaim disk space, remove the stopped container/image with Docker/Podman, |
| 8 | +// the container can be recreated from this config when needed. |
3 | 9 | { |
4 | | - "name": "Node.js & TypeScript", |
5 | | - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile |
6 | | - "image": "mcr.microsoft.com/devcontainers/typescript-node", |
| 10 | + // Display name shown by editor when selecting this dev container |
| 11 | + "name": "iCKB Dev Environment", |
| 12 | + |
| 13 | + // Base image from Microsoft devcontainers for a TypeScript + Node environment |
| 14 | + "image": "mcr.microsoft.com/devcontainers/typescript-node:24", |
| 15 | + |
| 16 | + // Persisted volumes to speed installs and avoid repeated network requests |
7 | 17 | "mounts": [ |
8 | | - "source=ickb-${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", |
9 | | - "source=ickb-${localWorkspaceFolderBasename}-dist,target=${containerWorkspaceFolder}/dist,type=volume", |
10 | | - "source=pnpm-cache,target=${containerWorkspaceFolder}/.pnpm-store,type=volume", |
11 | | - "source=local-store,target=${containerWorkspaceFolder}/.local-store,type=volume", |
12 | | - "source=gemini-code-assist,target=/home/node/.cache/google-vscode-extension,type=volume" |
| 18 | + // Share a pnpm store cache volume to speed package resolution and install times across projects/containers |
| 19 | + "source=pnpm-cache,target=${containerWorkspaceFolder}/.pnpm-store,type=volume" |
13 | 20 | ], |
14 | | - // Features to add to the dev container. More info: https://containers.dev/features. |
15 | | - // "features": {}, |
16 | | - // Use 'forwardPorts' to make a list of ports inside the container available locally. |
17 | | - // "forwardPorts": [], |
18 | | - // Use 'postCreateCommand' to run commands after the container is created. |
19 | | - "postCreateCommand": "sudo chown node -R . /home && npm install -g pnpm@latest", |
20 | | - // Configure tool-specific properties. |
21 | | - // "customizations": {}, |
22 | | - "postStartCommand": "pnpm install", |
| 21 | + |
| 22 | + // Run once after the container filesystem is created. |
| 23 | + // - Fix ownership so the non-root node user can access workspace files |
| 24 | + // - Install latest pnpm globally so postStartCommand and developer workflows use pnpm |
| 25 | + "postCreateCommand": "sudo corepack enable && sudo chown -R node:node /home/node ${containerWorkspaceFolder}", |
| 26 | + |
| 27 | + // Run each time the container starts. Ensures dependencies are installed inside the container user environment. |
| 28 | + "postStartCommand": "pnpm install --frozen-lockfile", |
| 29 | + |
| 30 | + // Use the non-root 'node' user provided by the base image for safer file access and to mirror deployment permissions |
23 | 31 | "remoteUser": "node", |
| 32 | + |
24 | 33 | "customizations": { |
25 | | - // Configure properties specific to VS Code. |
26 | 34 | "vscode": { |
27 | | - // Set *default* container specific settings.json values on container create. |
| 35 | + // Recommended and enforced editor settings for consistent linting/validation across contributors |
28 | 36 | "settings": { |
| 37 | + // Prefer editor config over global formatting where appropriate |
| 38 | + "editor.formatOnSave": true, |
| 39 | + "editor.codeActionsOnSave": { |
| 40 | + "source.fixAll.eslint": "explicit" |
| 41 | + }, |
29 | 42 | "eslint.validate": [ |
30 | 43 | "json", |
31 | 44 | "javascript", |
32 | 45 | "javascriptreact", |
33 | 46 | "typescript", |
34 | 47 | "typescriptreact" |
35 | 48 | ], |
36 | | - "geminicodeassist.chat.enableStreaming": false, |
37 | | - "geminicodeassist.enableTelemetry": false, |
38 | | - "geminicodeassist.inlineSuggestions.suggestionSpeed": "Fast", |
39 | | - "geminicodeassist.localCodebaseAwareness": false, |
40 | | - "geminicodeassist.rules": "As a terse, expert peer, be correct. Code only when most direct." |
| 49 | + // Disable telemetry to avoid sending usage data to Microsoft |
| 50 | + "telemetry.enableTelemetry": false |
41 | 51 | }, |
| 52 | + |
| 53 | + // Recommended extensions preinstalled in the container to provide a consistent developer experience |
42 | 54 | "extensions": [ |
43 | | - "streetsidesoftware.code-spell-checker", |
44 | | - "dbaeumer.vscode-eslint", |
45 | | - "esbenp.prettier-vscode", |
46 | | - "yoavbls.pretty-ts-errors", |
47 | | - "davidanson.vscode-markdownlint", |
48 | | - "github.vscode-github-actions", |
49 | | - "google.geminicodeassist" |
| 55 | + "streetsidesoftware.code-spell-checker", // basic spell checking in docs/comments |
| 56 | + "bradlc.vscode-tailwindcss", // Tailwind CSS IntelliSense if project uses Tailwind |
| 57 | + "dbaeumer.vscode-eslint", // ESLint integration for linting and autofix |
| 58 | + "esbenp.prettier-vscode", // Prettier for consistent formatting |
| 59 | + "yoavbls.pretty-ts-errors", // Improved TypeScript error messages |
| 60 | + "davidanson.vscode-markdownlint", // Markdown linting for docs |
| 61 | + "github.vscode-github-actions", // GitHub Actions workflow support |
| 62 | + "github.vscode-pull-request-github" // PR and issue integration with GitHub |
50 | 63 | ] |
51 | 64 | } |
52 | 65 | } |
|
0 commit comments