feat: 三种部署方式全部验证通过

方案1: docker-compose 双容器(原有,不变)
方案2: 二进制部署(go:embed 前端嵌入)
  - 修复 SPA fallback(c.FileFromFS 301 → c.Data 直接返回)
  - 二进制 22MB,内存 21.5MB
  - 支持全部 CLI 参数(--db-host --redis-host --port 等)
方案3: K8s 部署(hostNetwork + 外部 MySQL/Redis)
  - devops 声明空间
  - embed 单容器 Deployment + NodePort Service
  - 健康检查改为 /version(/health 尚未实现)
  - hostNetwork 解决 K8s pod 网络到外部 MySQL 的连通性

新增: Dockerfile.embed, docker-compose.embed.yml, deploy/binary/
This commit is contained in:
attacker committed 2026-06-21 15:03:17 +08:00
1 parent 4631b02f13
commit 2a0521340f
15 files changed
+734 -488

No files matched your search

+7 -2
View File
@@ -62,7 +62,12 @@ func setupFrontend(r *gin.Engine) {
return
}
// SPA fallback → index.html(React Router history 模式)
c.FileFromFS("/index.html", httpFS)
// SPA fallback → 直接返回 index.html 字节(避免 http.FileServer 的 301 redirect)
indexBytes, err := fs.ReadFile(staticFS, "index.html")
if err != nil {
c.String(http.StatusInternalServerError, "前端文件缺失")
return
}
c.Data(http.StatusOK, "text/html; charset=utf-8", indexBytes)
})
}