v30.62: dockerize + forgejo build pipeline #9

Merged
necrogami merged 2 commits from feat/dockerize-forgejo-pipeline into main 2026-08-06 16:34:50 +00:00
Contributor

Packages the game into a Docker image and adds a Forgejo Actions pipeline that publishes it to this instance's container registry.

What's in here

  • Dockerfile — node:22-alpine + python3. The SSR server re-runs the esbuild bundle at startup, so the runtime image needs node + devDependencies. Runs as non-root node, healthcheck on /api/players, port 5175.
  • docker-compose.yml — for the deploy server: pulls git.hl.c4.io/og_arist0tle/dark-spire:latest, bind-mounts ./saves:/app/saves so player saves live on the host, restart: unless-stopped.
  • .forgejo/workflows/build.yml — npm test gate (needs git + full history for test/v30-vs-current.mjs's worktree), then build + push :latest and :<short-sha>.
  • scripts/ssr-build.mjs — additive SSR_GIT_* env override so images (which contain no .git) still stamp the real version in the footer chip. CI computes the values from the checkout and passes them as build args. Local git fallback unchanged.

Before merging / to test

  1. Create repo secrets REGISTRY_USERNAME and REGISTRY_TOKEN (package:write scope) under Settings → Actions.
  2. Runner must have the docker label with access to a docker daemon.

Verified locally

Image builds (333 MB); footer renders v30.61 (6845004) inside the container; save POST→GET→/api/players roundtrip lands in the mounted volume; healthcheck goes healthy; full npm test green; docker compose config validates.

https://claude.ai/code/session_01RaLHHSp1qSk9L1oswRD8GJ

Packages the game into a Docker image and adds a Forgejo Actions pipeline that publishes it to this instance's container registry. ## What's in here - **Dockerfile** — `node:22-alpine` + python3. The SSR server re-runs the esbuild bundle at startup, so the runtime image needs node + devDependencies. Runs as non-root `node`, healthcheck on `/api/players`, port 5175. - **docker-compose.yml** — for the deploy server: pulls `git.hl.c4.io/og_arist0tle/dark-spire:latest`, bind-mounts `./saves:/app/saves` so player saves live on the host, `restart: unless-stopped`. - **.forgejo/workflows/build.yml** — `npm test` gate (needs git + full history for `test/v30-vs-current.mjs`'s worktree), then build + push `:latest` and `:<short-sha>`. - **scripts/ssr-build.mjs** — additive `SSR_GIT_*` env override so images (which contain no `.git`) still stamp the real version in the footer chip. CI computes the values from the checkout and passes them as build args. Local git fallback unchanged. ## Before merging / to test 1. Create repo secrets `REGISTRY_USERNAME` and `REGISTRY_TOKEN` (package:write scope) under Settings → Actions. 2. Runner must have the `docker` label with access to a docker daemon. ## Verified locally Image builds (333 MB); footer renders `v30.61 (6845004)` inside the container; save POST→GET→`/api/players` roundtrip lands in the mounted volume; healthcheck goes healthy; full `npm test` green; `docker compose config` validates. https://claude.ai/code/session_01RaLHHSp1qSk9L1oswRD8GJ
- Dockerfile: node:22-alpine + python3; the SSR server rebuilds at startup
  so the runtime image carries node + esbuild. Non-root, healthcheck on
  /api/players, port 5175.
- docker-compose.yml: registry image (git.hl.c4.io/og_arist0tle/dark-spire),
  ./saves bind-mounted to the host, restart unless-stopped.
- .forgejo/workflows/build.yml: npm test gate, then build + push :latest
  and :<short-sha> to the Forgejo container registry.
- ssr-build.mjs: SSR_GIT_* env override so images without .git still stamp
  the real version in the footer chip (git fallback unchanged).
- Design doc + task log.

Claude-Session: https://claude.ai/code/session_01RaLHHSp1qSk9L1oswRD8GJ
ci: run test job on PRs, gate image push to main
All checks were successful
build-and-publish / test (pull_request) Successful in 19s
build-and-publish / build (pull_request) Has been skipped
5568846d57
Claude-Session: https://claude.ai/code/session_01RaLHHSp1qSk9L1oswRD8GJ
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
og_arist0tle/dark-spire!9
No description provided.