Commit c355c9f
fix(container): repair Containerfile build rot + runtime.exs env config (#273)
## What
Makes `container/Containerfile` build and produce a **runnable Elixir
REST image**, and adds `config/runtime.exs` so runtime env is honoured.
Discovered while deploying boj-server to Hetzner (now **live** —
`https://api.boj-server.net/health` → 200).
## Six build-rot fixes
1. **.dockerignore** excluded `scripts/fetch-cartridges.sh` (needed by a
COPY) and `schemas/cartridge-v1.json` (Catalog schema mirror) →
un-ignored both. (Refs #271)
2. **Zig pin** — replaced unpinned `apk add zig` (wolfi rolls forward;
newer Zig removed `std.heap.GeneralPurposeAllocator`) with the
repo-declared **0.15.1** tarball (`.tool-versions`).
3. **Elixir builder** — `cgr.dev/chainguard/elixir:latest` is now
**403/auth-gated** → public `docker.io/elixir:1.18.4-otp-25`.
4. **Runtime base** — `cgr.dev/chainguard/wolfi-base` lost
`gcompat`/`ncurses-libs` and its OpenSSL 3 breaks the OTP-25 crypto NIF
(needs `libcrypto.so.1.1`) → **`debian:bullseye-slim`** (matches builder
ABI).
5. **Schema** — COPY `schemas/cartridge-v1.json` into `/schemas`
(Catalog requires it at boot, else RuntimeError).
6. **.zig-cache strip** — the cartridge tree carried multi-GB Zig caches
copied into the runtime stage, exhausting build disk; stripped in the
builder stage.
## runtime.exs
`config/runtime.exs` re-reads `BOJ_PORT` / `BOJ_BIND_IP` /
`BOJ_CARTRIDGES_ROOT` / `BOJ_DATA_DIR` at **release boot**. Without it,
`mix release` bakes config.exs's env lookups at *build* time, so:
- the listener bound `127.0.0.1` (unreachable via port-map — required an
ugly `--network host` workaround), and
- `cartridges_root` was a build path → **`cartridges_loaded:0`**.
Both are fixed by evaluating env at runtime.
## Validation
All six fixes applied and **verified end-to-end on the Hetzner host** —
image builds, container runs, `/health` returns `{"status":"ok"}`. Once
a `v*` tag build runs with this Containerfile, `container-publish.yml`
will publish a correct `:latest` (the current ghcr `:latest`/`:main` are
a stale Node MCP-bridge image — #272; this PR is the fix).
Closes #271. Refs #272.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 5362680 commit c355c9f
3 files changed
Lines changed: 35 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
62 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
63 | 70 | | |
64 | 71 | | |
65 | 72 | | |
| |||
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
80 | | - | |
| 87 | + | |
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
| |||
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
93 | | - | |
| 100 | + | |
94 | 101 | | |
95 | 102 | | |
96 | | - | |
| 103 | + | |
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
| |||
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments