Skip to content

Single binary with UI assets - #46

Merged
heapoftrash merged 10 commits into
mainfrom
feat/embed-frontend
Mar 25, 2026
Merged

heapoftrash merged 10 commits into
mainfrom
feat/embed-frontend

Conversation

@heapoftrash

Copy link
Copy Markdown
Owner

Description

Single binary release with go embedding UI assets in the binary Closes #45

Type of change

  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Backend: go build ./... && go vet ./... && go test ./... passes
  • Frontend: npm run build passes
  • Commit messages follow Conventional Commits

Manas Maiti added 10 commits March 25, 2026 15:11
- Add web package (go:embed dist, stub without tag) and DistRoot helper
- mountFrontend: prefer embedded FS, else frontend/dist on disk
- Container and CI build with embed; Makefile embed targets
- Document embedded vs disk UI in README, MkDocs, CONTRIBUTING
- Module path: github.com/heapoftrash/filetree/app
- Colocate embed with Vite outDir (app/web/dist); drop cp step in Makefile/CI
- Containerfile, dockerignore, dependabot, labeler, CI job ids (app, app-embed)
- Update README, CONTRIBUTING, and getting-started docs
Move go:embed and DistRoot into a Go-only package. Vite still outputs
to app/web/dist; make embed-ui copies into app/uiembed/dist before
go build -tags embed. CI stages the same way; Containerfile copies
the Node stage output to ./uiembed/dist. Disk serving checks
app/web/dist and app/uiembed/dist (and cwd-relative paths).

Remove unused frontend-dist download from docker-push (image builds
via multi-stage only).
build and all run build-frontend, embed-ui, and go build -tags embed.
build-app remains for Go-only dev builds; build-app-embed aliases build.
Update README and getting-started docs accordingly.
StaticFile/StaticFileFS with path "/" returned 301 Location: "./",
which causes broken redirects. Use explicit GET/HEAD handlers instead.
Gin FileFromFS rewrites the request path to "/index.html"; net/http
FileServer then issues 301 Location "./" (stdlib special case). Serve
index.html with fs.ReadFile + explicit headers instead.

Add regression test for GET/HEAD /.
upload-artifact archives paths relative to the uploaded directory, so
extracting to the workspace root placed index.html/assets beside the
repo instead of under app/web/dist. The embed copy then read an empty
gitignored tree. Extract to app/web/dist to match make embed-ui.
Extract attachDistRoutes from mountEmbeddedFrontend so tests exercise the
same registration as embed builds. Assert /assets, favicon, icon-light,
/client routes, and no-assets layout.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Mar 25, 2026
@heapoftrash heapoftrash self-assigned this Mar 25, 2026
@heapoftrash
heapoftrash merged commit 9a28ebd into main Mar 25, 2026
11 checks passed
@heapoftrash heapoftrash added frontend Related to frontend backend Related to backend labels Mar 25, 2026
@heapoftrash
heapoftrash deleted the feat/embed-frontend branch March 25, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Related to backend documentation Improvements or additions to documentation frontend Related to frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embed frontend dist in Go binary (single-binary release)

1 participant