Files
Blizzard 28a1543249 feat(gateway): 内嵌 admin 控制台(go:embed),去掉单独 nginx 容器
复刻 sundynix-site 的 webfs 模式:gateway 一个容器同时 serve 控制台 UI + API + 供
桌面端直连。admin 用 HashRouter + API base 走相对 /api/v1(构建传 VITE_GATEWAY=''),
源码零改动即可同源 serve。

- internal/webui:go:embed all:admin_dist + Dist();占位 index.html 让不构建前端也能编译。
  目录命名 admin_dist(避开 .gitignore dist/ 与 .dockerignore **/dist 通配)。
- router.go NoRoute:非 /api/ 路径走内嵌静态,命中 /assets/* 直吐、否则回退 index.html;
  embed 失败仅 log 降级不影响 API。/metrics /healthz /readyz /api/v1 已注册,永不进 NoRoute。
- Dockerfile 加 admin node 构建 stage,go build 前 COPY dist 覆盖 embed 占位。
- live 验证:/ 返回 admin(200)、/assets/*.js(200)、/api/v1/admin/overview(401 走 API)、/healthz(200)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 14:45:24 +08:00
..