Skip to content

feat(docker): self-host image on GHCR - #211

Merged
ajithakdev merged 3 commits into
mainfrom
feat/docker
Nov 9, 2026
Merged

ajithakdev merged 3 commits into
mainfrom
feat/docker

Conversation

@ajithakdev

Copy link
Copy Markdown
Owner

Adds a Docker image so people can run their own Toolglass, which is the entry point for r/selfhosted and awesome-selfhosted (see docs/NEXT.md).

What's in it

  • Dockerfile: builds the site with Node 22 on the build platform, then serves dist with nginx-unprivileged on port 8080 (runs as uid 101). The image is about 57 MB.
  • docker/nginx.conf: /tools/<slug> maps to tools/<slug>.html the same way GitHub Pages does, unknown paths get 404.html with status 404, /assets/ is cached for a year, sw.js is no-cache, and it adds nosniff, no-referrer and frame-deny headers.
  • .github/workflows/docker.yml: a v* tag builds amd64 and arm64 and pushes ghcr.io/ajithakdev/toolglass as X.Y.Z, X.Y and latest. A PR that touches the Docker files only builds. Nothing is published on merge.
  • README: a one-line docker run near the top, a "Self-host with Docker" section with Compose, and a line naming the upload-first sites it replaces. Also updated CHANGELOG, CODEMAP, RESOURCES-AND-GUIDE and NEXT.

Tested locally (Podman)

  • The image builds, and the container runs as nginx (uid 101).
  • /, /tools/json, /about, /sitemap.xml return 200; /tools/nope returns 404 and renders the in-app "Tool Not Found" page.
  • Hashed assets get max-age=31536000, immutable, and sw.js gets no-cache.
  • In a browser, the JSON Formatter loaded from the container and worked.

Not covered

  • The service worker didn't register in the test browser over plain http, but vite preview failed the same way there, so it's a browser limitation, not the image. It needs HTTPS or a real localhost browser.
  • Sub-path hosting (example.com/tools/) isn't supported. The README says to use the root of a domain or subdomain.
  • The first GHCR publish happens on the next release tag. After that, the package may need to be set to public once in its GitHub settings (free).

@ajithakdev

Copy link
Copy Markdown
Owner Author

Pre-merge checklist

Addressed

  • Two-stage Dockerfile: Node 22 build on the build platform, nginx-unprivileged serves dist on 8080
  • nginx routes match GitHub Pages (/tools/<slug> to tools/<slug>.html, 404 to 404.html)
  • Cache headers: a year, immutable, for /assets/; no-cache for sw.js
  • GHCR publish only on v* tags (amd64 and arm64); PRs build without pushing

Tested (local Podman)

  • Image builds (57.4 MB) and runs as uid 101
  • /, /tools/json, /about, /sitemap.xml return 200; /tools/nope returns 404 with the in-app not-found page
  • JSON Formatter loads and renders from the container in a browser
  • Service worker over HTTPS (the test browser blocks it on plain-http localhost for vite preview too)

CI and release

  • verify green
  • image (multi-arch build, no push) green
  • First GHCR publish on the v1.3.0 tag, then set the package to public once

Docs

  • README: one-line docker run at the top, "Self-host with Docker" section with Compose
  • CHANGELOG Unreleased, CODEMAP, RESOURCES-AND-GUIDE, NEXT.md updated

After merge: release v1.3.0 on Sunday 2026-11-15. Check that docker run -p 8080:8080 ghcr.io/ajithakdev/toolglass pulls without logging in.

@ajithakdev
ajithakdev merged commit cdddf6b into main Nov 9, 2026
4 checks passed
@ajithakdev
ajithakdev deleted the feat/docker branch November 9, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant