Single binary with UI assets - #46
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Single binary release with go embedding UI assets in the binary Closes #45
Type of change
Checklist
go build ./... && go vet ./... && go test ./...passesnpm run buildpasses