You've already forked agentic-coding-workflow
feat(server): embed SPA dist with fallback handler; single-binary deploy
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// Package main 的 embed.go 持有前端构建产物。
|
||||
// build 流程会先 pnpm build 再把 web/dist 复制到 cmd/server/web/dist/,
|
||||
// go:embed 在编译期把整个目录注入到二进制。.gitkeep 占位文件保证未跑
|
||||
// `make build` 时 go build 也能成功(embed 不接受空目录)。
|
||||
package main
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed all:web/dist
|
||||
var distFS embed.FS
|
||||
+1
-1
@@ -25,7 +25,7 @@ func main() {
|
||||
rootCtx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
|
||||
a, err := app.New(rootCtx, cfg)
|
||||
a, err := app.New(rootCtx, cfg, distFS)
|
||||
if err != nil {
|
||||
_, _ = fmt.Fprintln(os.Stderr, "app new:", err)
|
||||
os.Exit(1)
|
||||
|
||||
Vendored
Reference in New Issue
Block a user