Skip to content

fix(container): repair Containerfile build rot + runtime.exs env config#273

Merged
hyperpolymath merged 3 commits into
mainfrom
fix/containerfile-build-rot-and-runtime-config
Jul 9, 2026
Merged

fix(container): repair Containerfile build rot + runtime.exs env config#273
hyperpolymath merged 3 commits into
mainfrom
fix/containerfile-build-rot-and-runtime-config

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

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 livehttps://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 [Bug] container/Containerfile build fails: .dockerignore excludes scripts/fetch-cartridges.sh #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 buildercgr.dev/chainguard/elixir:latest is now 403/auth-gated → public docker.io/elixir:1.18.4-otp-25.
  4. Runtime basecgr.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

…env config

The container/Containerfile build was broken end-to-end; six fixes make
`podman build -f container/Containerfile` succeed and produce a runnable REST image:

1. .dockerignore excluded scripts/fetch-cartridges.sh (needed by COPY) and
   schemas/cartridge-v1.json (Catalog schema mirror) — un-ignored both.
2. Pin Zig to 0.15.1 (.tool-versions) instead of unpinned `apk add zig`, which
   pulled a newer Zig that removed std.heap.GeneralPurposeAllocator.
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. COPY schemas/cartridge-v1.json into /schemas (Catalog requires it at boot).
6. Strip multi-GB .zig-cache from the cartridge tree before the runtime COPY
   (was exhausting build disk).

Plus config/runtime.exs so BOJ_PORT / BOJ_BIND_IP / BOJ_CARTRIDGES_ROOT are read
at release boot, not baked at compile time — fixes the listener binding to
127.0.0.1 (unreachable via port-map) and cartridges_loaded:0 (baked build-path).

Deployed and verified live on Hetzner: /health returns 200.

Refs #271, #272.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hyperpolymath hyperpolymath enabled auto-merge (squash) July 9, 2026 06:01
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 215 issues detected

Severity Count
🔴 Critical 15
🟠 High 133
🟡 Medium 67

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "pages-deploy.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in build.yml",
    "type": "missing_timeout_minutes",
    "file": "build.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in pages-deploy.yml",
    "type": "missing_timeout_minutes",
    "file": "pages-deploy.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in push-email-notify.yml",
    "type": "missing_timeout_minutes",
    "file": "push-email-notify.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in scorecard-enforcer.yml",
    "type": "missing_timeout_minutes",
    "file": "scorecard-enforcer.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in scorecard-enforcer.yml",
    "type": "scorecard_publish_with_run_step",
    "file": "scorecard-enforcer.yml",
    "action": "split_scorecard_publish_job",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in instant-sync.yml",
    "type": "secret_action_without_presence_gate",
    "file": "instant-sync.yml",
    "action": "peter-evans/repository-dispatch",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in codeql.yml",
    "type": "codeql_missing_actions_language",
    "file": "codeql.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/academic-workflow-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/ephapax-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

…artridges_root)

With runtime.exs correctly setting cartridges_root=/app/cartridges, Catalog derives
the schema mirror at dirname(cartridges_root)/schemas = /app/schemas/cartridge-v1.json
(catalog.ex default_schema_path). Ship it there (keep /schemas as fallback).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 215 issues detected

Severity Count
🔴 Critical 15
🟠 High 133
🟡 Medium 67

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "pages-deploy.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in build.yml",
    "type": "missing_timeout_minutes",
    "file": "build.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in pages-deploy.yml",
    "type": "missing_timeout_minutes",
    "file": "pages-deploy.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in push-email-notify.yml",
    "type": "missing_timeout_minutes",
    "file": "push-email-notify.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in scorecard-enforcer.yml",
    "type": "missing_timeout_minutes",
    "file": "scorecard-enforcer.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in scorecard-enforcer.yml",
    "type": "scorecard_publish_with_run_step",
    "file": "scorecard-enforcer.yml",
    "action": "split_scorecard_publish_job",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in instant-sync.yml",
    "type": "secret_action_without_presence_gate",
    "file": "instant-sync.yml",
    "action": "peter-evans/repository-dispatch",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in codeql.yml",
    "type": "codeql_missing_actions_language",
    "file": "codeql.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/academic-workflow-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/ephapax-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath hyperpolymath disabled auto-merge July 9, 2026 08:33
@hyperpolymath hyperpolymath merged commit c355c9f into main Jul 9, 2026
10 of 11 checks passed
@hyperpolymath hyperpolymath deleted the fix/containerfile-build-rot-and-runtime-config branch July 9, 2026 08:34
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 215 issues detected

Severity Count
🔴 Critical 15
🟠 High 133
🟡 Medium 67

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "pages-deploy.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in build.yml",
    "type": "missing_timeout_minutes",
    "file": "build.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in pages-deploy.yml",
    "type": "missing_timeout_minutes",
    "file": "pages-deploy.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in push-email-notify.yml",
    "type": "missing_timeout_minutes",
    "file": "push-email-notify.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in scorecard-enforcer.yml",
    "type": "missing_timeout_minutes",
    "file": "scorecard-enforcer.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in scorecard-enforcer.yml",
    "type": "scorecard_publish_with_run_step",
    "file": "scorecard-enforcer.yml",
    "action": "split_scorecard_publish_job",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in instant-sync.yml",
    "type": "secret_action_without_presence_gate",
    "file": "instant-sync.yml",
    "action": "peter-evans/repository-dispatch",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in codeql.yml",
    "type": "codeql_missing_actions_language",
    "file": "codeql.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/academic-workflow-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/ephapax-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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.

[Bug] container/Containerfile build fails: .dockerignore excludes scripts/fetch-cartridges.sh

1 participant