chore(devcontainer): refine configuration and simplify tasks
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 1m58s
CI/CD Pipeline / build-and-deploy (push) Successful in 2m12s

This commit is contained in:
严浩
2025-11-12 23:56:59 +08:00
parent 10fcb40d1d
commit d0a7afd5df
3 changed files with 25 additions and 54 deletions

View File

@@ -1,3 +1,4 @@
# docker build -t my-dev-container .
FROM debian:13.1-slim FROM debian:13.1-slim
# 元数据 # 元数据

View File

@@ -6,23 +6,8 @@
*/ */
{ {
"name": "SBX", "name": "SBX",
"forwardPorts": [4730, 4731], // vscode://settings/remote.localPortHost -> 默认只监听 localhost "image": "my-dev-container",
"portsAttributes": { // "build": { "dockerfile": "Dockerfile", "args": {} },
"4730": {
"label": "开发服务器端口",
"onAutoForward": "notify"
},
"4731": {
"label": "预览服务器端口",
"onAutoForward": "notify"
}
},
"build": {
"dockerfile": "Dockerfile",
"args": {
//
}
},
"runArgs": [ "runArgs": [
// ----- // -----
// "--network=host", // "--network=host",
@@ -36,22 +21,29 @@
"--add-host=host.docker.internal:host-gateway", "--add-host=host.docker.internal:host-gateway",
"--name=${localWorkspaceFolderBasename}-devcontainer" "--name=${localWorkspaceFolderBasename}-devcontainer"
], ],
"forwardPorts": [4730, 4731], // vscode://settings/remote.localPortHost -> 默认只监听 localhost
"portsAttributes": {
"4730": { "label": "开发服务器端口", "onAutoForward": "openPreview" },
"4731": { "label": "预览服务器端口", "onAutoForward": "notify" }
},
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [
// AI // AI
"github.copilot",
"github.copilot-chat",
"vicanent.gcmp",
"anthropic.claude-code", "anthropic.claude-code",
"google.gemini-cli-vscode-ide-companion", "google.gemini-cli-vscode-ide-companion",
"kilocode.kilo-code", "kilocode.kilo-code",
"alibaba-cloud.tongyi-lingma", "alibaba-cloud.tongyi-lingma",
// >>>>> // >>>>>
"vue.volar", "gruntfuggly.todo-tree",
"lokalise.i18n-ally",
"eamodio.gitlens", "eamodio.gitlens",
"lokalise.i18n-ally",
"vitest.explorer", "vitest.explorer",
"antfu.unocss", "antfu.unocss",
"vicanent.gcmp", "vue.volar",
"gruntfuggly.todo-tree",
// <<<<< // <<<<<
// 代码质量 / 格式化 / Lint // 代码质量 / 格式化 / Lint
"editorconfig.editorconfig", "editorconfig.editorconfig",
@@ -67,17 +59,10 @@
{ {
"type": "npm", "type": "npm",
"script": "dev", "script": "dev",
"label": "🚀 dev-in-container", "label": "🚀 Dev: Run on Folder Open",
"detail": "启动开发服务器", "detail": "启动开发服务器",
"runOptions": { "runOn": "folderOpen" }, "runOptions": { "runOn": "folderOpen" },
"problemMatcher": { "problemMatcher": [],
"pattern": { "regexp": "." },
"background": {
"activeOnStart": true,
"beginsPattern": "VITE.*ready in",
"endsPattern": "(Local|Network):.*http"
}
},
"isBackground": true, "isBackground": true,
"presentation": { "reveal": "always", "panel": "dedicated" }, "presentation": { "reveal": "always", "panel": "dedicated" },
"group": { "kind": "build", "isDefault": false } "group": { "kind": "build", "isDefault": false }
@@ -89,16 +74,13 @@
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
}, },
"terminal.integrated.defaultProfile.linux": "zsh", "terminal.integrated.defaultProfile.linux": "💲zsh",
"terminal.integrated.profiles.linux": { "terminal.integrated.profiles.linux": {
"🐚bash": {
"path": "bash",
"icon": "terminal-bash"
},
"💲zsh": { "💲zsh": {
"path": "zsh", "path": "zsh",
"icon": "terminal-cmd", "icon": "terminal-cmd",
"overrideName": true "overrideName": true,
"color": "terminal.ansiGreen"
} }
}, },
// https://stackoverflow.com/questions/75708866/vscode-dev-container-fails-to-load-ms-vscode-js-debug-extension-correctly // https://stackoverflow.com/questions/75708866/vscode-dev-container-fails-to-load-ms-vscode-js-debug-extension-correctly

24
.vscode/tasks.json vendored
View File

@@ -6,16 +6,12 @@
"script": "dev", "script": "dev",
"label": "🚀 dev", "label": "🚀 dev",
"detail": "启动开发服务器", "detail": "启动开发服务器",
"problemMatcher": { "problemMatcher": [],
"pattern": { "regexp": "." },
"background": {
"activeOnStart": true,
"beginsPattern": "VITE.*ready in",
"endsPattern": "(Local|Network):.*http"
}
},
"isBackground": true, "isBackground": true,
"presentation": { "reveal": "always", "panel": "dedicated" }, "presentation": {
"reveal": "always", // 控制运行任务的终端是否显示。可按选项 "revealProblems" 进行替代。默认设置为“始终”。
"panel": "dedicated" // dedicated一个任务独占一个终端方便查看特定任务的日志不会被其他任务干扰。
},
"group": { "kind": "build", "isDefault": false } "group": { "kind": "build", "isDefault": false }
}, },
{ {
@@ -23,7 +19,6 @@
"script": "build-only", "script": "build-only",
"label": "🔨 build-only", "label": "🔨 build-only",
"detail": "" /* VSCode 使 package.json scripts[scriptName] detail */, "detail": "" /* VSCode 使 package.json scripts[scriptName] detail */,
"problemMatcher": ["$tsc"],
"presentation": { "reveal": "always", "panel": "shared" }, "presentation": { "reveal": "always", "panel": "shared" },
"group": { "kind": "none", "isDefault": false } "group": { "kind": "none", "isDefault": false }
}, },
@@ -33,14 +28,7 @@
"label": "☁️ wrangler:dev", "label": "☁️ wrangler:dev",
"detail": "启动 Cloudflare Workers 开发服务器,相当于预览", "detail": "启动 Cloudflare Workers 开发服务器,相当于预览",
"dependsOn": ["🔨 build-only"], "dependsOn": ["🔨 build-only"],
"problemMatcher": { "problemMatcher": [],
"pattern": { "regexp": "." },
"background": {
"activeOnStart": true,
"beginsPattern": "wrangler dev",
"endsPattern": "Ready on"
}
},
"isBackground": true, "isBackground": true,
"presentation": { "reveal": "always", "panel": "dedicated" }, "presentation": { "reveal": "always", "panel": "dedicated" },
"group": { "kind": "build", "isDefault": false } "group": { "kind": "build", "isDefault": false }