Docker operation
Decisions
Section titled “Decisions”- [E] Delivery with Docker Compose, Caddy in front like in muffelblog.
compose.yamlalone is the production setup behind the operator’s reverse proxy; Caddy listens on127.0.0.1:8080(NOVA_BIND,NOVA_HTTP_PORT). - [E] Settings from
.env(docker/init-env.shcreates it from.env.example), secrets from files insecrets/as Compose secrets. - [E] The SMTP password reaches the game only through the secret file;
compose.yamlpasses noSMTP_PASSWORDvariable. [E] The key of the data (secrets/data_key,NOVA_DATA_KEY_FILE, #620) is a secret file too, made once bydocker/init-env.sh, never overwritten, never in/data. - [E] The database lives in the volume
dataand survives restarts, updates and reboots. The CI restarts the stack and logs in again to check it. - [E]
compose.demo.yamladds Mailpit for the demo and the CI;docker/init-env.sh --demosets it up.
Services
Section titled “Services”| Service | Image | Role |
|---|---|---|
app |
ghcr.io/heiss/nova-imperium (built from Dockerfile, target app) |
The game server, port 8080 in the Docker network only. |
web |
caddy:2.11-alpine |
Headers, compression, X-Real-IP; the only published port. |
mailpit |
axllent/mailpit:v1.33 |
Demo and CI only: mail sink with a web interface on 127.0.0.1:8025. |
- [E] Node 26 (
.node-version), multi-stage: dependencies, client build, then a runtime stage with only the production dependencies, the built client and the server sources. - [V] The runtime image holds no npm, pnpm, compiler or tests; the CI
checks this. It runs as uid 1000 (
node). - [V] A build behind a TLS-inspecting proxy passes the CA as a build
secret (
--secret id=ca,src=…); without it nothing changes. - [U] The arm64 image is built by the release workflow (QEMU) and was not started on real arm64 hardware.
- [E] Decided for #484, not built yet (owner, 2026-11-28): the base
becomes Alpine (a clean
alpinewith the Node binary ofnode:26-alpine, see below), replacing the Debian base and Debian’s security updates on top of it (2026-11-12); the updates stay as a layerapk upgradein every release, night and hotfix, and the security hotfix and the Trivy gate move to Alpine; a security release of Node waits for the Alpine digest, with an issue meanwhile. arm64 is dropped:linux/amd64only, so the point above and U3 go. A stage of the production dependencies keyed on the manifests and the lockfile; better-sqlite3 only withlinuxmusl-x64and withoutdeps/; no tests and no npm in any layer (owner, 2026-11-30: a clean Alpine base,alpinepinned by digest, with the Node binary copied fromnode:26-alpineand only the libraries it needs; npm, corepack and yarn are in no layer; [V] the librarieslibstdc++andlibgcc, and the security hotfix and Renovate watch both digests); the CI records the size of the image and of the changed layers. One pull request. This replaces the bullets above once #484 is built. - [E] Replaced on 2026-12-01 (owner, #594, not built yet): the runtime
image is
scratch. Node, its glibc libraries and the loader are copied from a Debian build stage (node:26-slimwithapt-get full-upgrade), not from Alpine; the rest of the bullet above stays (arm64 dropped, a stage of the production dependencies, one prebuild of better-sqlite3, now for glibc, no npm or tests in any layer). No shell and no program besidesnode, no CA bundle (Node’s own roots), three layers (runtime,node_modules, application),novawith a shebang tonodeand maintenance commands for an operator without a shell, the Trivy gate on an SBOM of the build stage, size and layers measured and kept by a ratchet. - [E] No package may need AVX: the server is a Celeron J4104 without it (owner, 2026-11-27, #449). The CI starts the built app a second time on an emulated CPU without AVX and runs the smoke test against it (291a).
- [V] How:
compose.noavx.yamlruns the image’s Node under QEMU user mode with the CPU model Denverton (an Atom of the Goldmont family, no AVX) in the job „Docker image and Compose stack“, on an empty data volume, so the fresh database is created and migrated under QEMU. Shown on 2026-11-27: a binary built with-mavxstops there with „Illegal instruction“, and the server starts, creates its database and answers. - [V] The release image too (#456): the job „The release image runs on
a CPU without AVX“ of
release.yml(scripts/release-noavx.sh) starts the pushed amd64 image by digest under QEMU, with the entrypoint ofcompose.noavx.yamland the static binary ofqemu-user-static(or ofqemu-userwhere that is only virtual, newer Ubuntu;scripts/static-qemu.sh, the one rule that the check of CI uses too: ldd’s words decide, not its exit code, since a static binary that is not static-pie makes ldd exit 1), on a fresh volume, with the hardening of the app incompose.yaml(read-only,/tmpas tmpfs, no capabilities, no new privileges) and the mail codes off (no mail server), and waits up to 90 tries two seconds apart for/healthz; a container that stopped fails at once. Then it checks that PID 1 runs under QEMU. A failure shows the log of the container and stops the aliases. A change ofscripts/static-qemu.shruns the image checks of CI. It differs from the CI check: no Caddy, no mail and no smoke test, only the server, its fresh database and/healthz, as the issue asks. The script is tested with stubs (src/test/release-noavx.test.ts); the real release is not run for it.
Hardening (proposals, in place)
Section titled “Hardening (proposals, in place)”- [V] Both containers: read-only root file system,
cap_drop: ALL(Caddy keepsNET_BIND_SERVICE),no-new-privileges. - [V] Caddy removes
ServerandVia, replaces the security headers of the game with the same values (a test keeps both equal) and setsX-Real-IPfromclient_ip;NOVA_TRUSTED_PROXIESnames the proxies whoseX-Forwarded-Foris believed. - [V] Health checks:
appasks/healthz(database included),webanswers on an internal port:2020.