{ "image": "ghcr.io/yanhao98/h-devcontainer:main", "runArgs": ["--name=${localWorkspaceFolderBasename}-devcontainer"], "forwardPorts": [4730, 4731], // vscode://settings/remote.localPortHost -> 默认只监听 localhost "portsAttributes": { "4730": { "label": "开发服务器端口", "onAutoForward": "notify" }, "4731": { "label": "预览服务器端口", "onAutoForward": "notify" } }, "remoteEnv": { "ANTHROPIC_AUTH_TOKEN": "${localEnv:ANTHROPIC_AUTH_TOKEN}", "ANTHROPIC_BASE_URL": "${localEnv:ANTHROPIC_BASE_URL}", "GEMINI_API_KEY": "${localEnv:GEMINI_API_KEY}", "GOOGLE_GEMINI_BASE_URL": "${localEnv:GOOGLE_GEMINI_BASE_URL}" }, "containerEnv": { "NODE_OPTIONS": "--max-old-space-size=4096", "TZ": "${localEnv:TZ:Asia/Shanghai}" }, "customizations": { "vscode": { "extensions": [ // AI "github.copilot-chat", "anthropic.claude-code", "google.gemini-cli-vscode-ide-companion", "vicanent.gcmp", // >>>>> // "eamodio.gitlens", "tu6ge.naive-ui-intelligence", "gruntfuggly.todo-tree", "lokalise.i18n-ally", "vitest.explorer", "antfu.unocss", "vue.volar", // <<<<< // 代码质量 / 格式化 / Lint "dbaeumer.vscode-eslint", "stylelint.vscode-stylelint", "oxc.oxc-vscode", "esbenp.prettier-vscode" ], "settings": { "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, "chat.extensionUnification.enabled": true, "chat.tools.terminal.autoApprove": { "/.*/": true, "git push": false }, // * 尽管使用了“/.*/”,但有些还是会失败,因为有几个错误的默认值: // * https://github.com/microsoft/vscode/issues/266651#issuecomment-3292581459 "chat.tools.terminal.ignoreDefaultAutoApproveRules": true, "tasks": { "version": "2.0.0", "tasks": [] }, "terminal.integrated.defaultProfile.linux": "zsh" } } }, "mounts": [ // 不挂载还可能会遇到:`Cannot run macOS (Mach-O) executable in Docker: Exec format error` "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", "source=${localWorkspaceFolder}/.devcontainer/lifecycle-scripts.d,target=/usr/local/etc/lifecycle-scripts.d,type=bind,consistency=delegated" ], "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind,consistency=delegated", "initializeCommand": "docker pull ghcr.io/yanhao98/h-devcontainer:main;", "onCreateCommand": "/usr/local/bin/run-lifecycle-scripts.sh onCreateCommand", "updateContentCommand": "/usr/local/bin/run-lifecycle-scripts.sh updateContentCommand", "postCreateCommand": "/usr/local/bin/run-lifecycle-scripts.sh postCreateCommand", "postStartCommand": "/usr/local/bin/run-lifecycle-scripts.sh postStartCommand", "postAttachCommand": "/usr/local/bin/run-lifecycle-scripts.sh postAttachCommand", "waitFor": "updateContentCommand", "remoteUser": "usr_vscode" }