Skip to content

build(image): build the server image with apko and melange, and install mise on first start - #71

Merged
sweepies merged 11 commits into
mainfrom
capy/apko-image
Oct 29, 2026
Merged

sweepies merged 11 commits into
mainfrom
capy/apko-image

Conversation

@sweepies

@sweepies sweepies commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Draft. Measurements are from this PR's release-workflow run at c03f579 (run 40906705492, the image job is unchanged since) unless they're marked local.

What changes

  • No Dockerfile. image/apko.yaml builds the image from Wolfi packages. image/patchula.melange.yaml packages patchula from the smoke-tested musl release archives, and image/packslip.melange.yaml packages packslip 1.11.1's static release binaries, each pinned by sha256. Wolfi has no packslip package. Each build takes Wolfi's current packages, so a release picks up Wolfi's fixes without a lock to refresh.
  • mise isn't in the image any more. With no mise on PATH, patchula serve (after it checks the App key locally, before it signs in to GitHub) and patchula tools install run packslip install github.com/jdx/mise --version <pinned> --pin ps1_nlhmwtfeufglxv5myvwvronk7a into $PATCHULA_TOOLS_DIR/patchula-mise/<version> as user 10001. The version is the existing mise pin in crates/update/src/lockfiles/defaults.toml, so there's one constant. A present install is reused. The install runs under the tool store's exclusive lock, so replicas sharing a volume install it once. Older versions are removed after a newer one installs. A failed install logs cannot install mise with packslip's reason and the server keeps running.
  • dotnet: the image sets DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 and adds libssl3, because Wolfi's git and curl now use OpenSSL 4 and .NET needs OpenSSL 3. The lockfile runner clears the tool environment, so the variable is now passed on to dotnet restore. Without that change, setting it in the image would have had no effect.
  • CI: the image job runs nu tasks image:build, image:smoke (amd64 in full, arm64 quick checks) and image:push. On tags it publishes with apko publish and fails unless the published index digest equals the one the smoke test ran. It then attests build provenance and each platform's SBOM with GitHub attestations. A pull request touching image/**, mise-tasks/image/** or release.yml builds the Linux archives and the image and smoke-tests them, without publishing, and a newer push cancels its older run. The image job sets MISE_LOCKED=1, so installing melange and apko doesn't make mise re-lock every tool (that had cost 9 s).

Behaviour changes for operators

  • No HEALTHCHECK and no EXPOSE, because apko can't set them. The server guide documents Docker, Compose and Kubernetes health checks. curl stays in the image for those.
  • The first start needs GitHub to fetch mise, or a pre-seeded volume (patchula tools install, documented).
  • SBOM and provenance are GitHub attestations now, not BuildKit attestation manifests.

Before / after

v0.5.1 (Debian slim + Dockerfile) This PR (apko)
Size, amd64 522 MB / 137 MB compressed 172 MB / 52 MB compressed (local)
CVEs grype 336, trivy 343 grype 0, trivy 0 (grype 0.121.0, trivy 0.76.1, local amd64 build)
What was built BuildKit provenance The GitHub provenance attestation records the commit and workflow run that built a tag's image. image:push publishes only the exact image the smoke test ran: it rebuilds from the same job's package cache and fails on any other digest. A rebuild later takes newer Wolfi packages and gives a different digest.
First start (mise via packslip) n/a (baked in) 15.4 s on GitHub (13.5–16.5 s locally)
Image job on GitHub 3m03s (arm64 apt under QEMU 1m54s) 1m27s: build 19 s, amd64 smoke 43 s (first start, dotnet restore, node), QEMU setup 10 s, arm64 smoke 1 s, checkout, artifacts and mise 11 s

Open in Capy

…ll mise on first start

The image is now built from Wolfi packages by apko, with patchula and packslip
packaged by melange, and no Dockerfile. It no longer bakes mise in: when no
mise is on PATH, patchula serve and patchula tools install install the pinned
mise into the tool store with packslip, held to mise's signer. The lockfile
runner passes DOTNET_SYSTEM_GLOBALIZATION_INVARIANT on to dotnet restore,
which the ICU-less image sets.

The image job runs nu tasks (image:build, image:smoke, image:push), publishes
only the index the smoke test ran, and attests provenance and per-platform
SBOMs. A pull request that touches the image builds and smoke-tests it
without publishing.
@deepsource-io

deepsource-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in c7bec57...21c241e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Oct 29, 2026 6:55p.m. Review ↗
JavaScript Oct 29, 2026 6:55p.m. Review ↗
Shell Oct 29, 2026 6:55p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment thread crates/update/src/lockfiles/dotnet.rs Resolved
Comment thread crates/update/src/lockfiles/tools.rs Resolved
@context7

context7 Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Docs7 for sweepies/count-patchula

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit 21c241e

@sweepies
sweepies marked this pull request as ready for review October 29, 2026 01:47
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Reviews (4) · Last reviewed commit: "fix(image): give each architecture's pat..." · Reviewed by Greptile

Comment thread crates/update/src/lockfiles/tools.rs Resolved
Comment thread docs/src/content/docs/guide/server.mdx Resolved
Replicas sharing a volume, or a server beside patchula tools install, could bootstrap at once and remove each other's unfinished install. The second now waits and finds the first one's mise.
A fresh build resolved Wolfi's newest packages, so it only matched an earlier digest until Wolfi published an update. image:lock pins every package and its dependencies, and image:build holds both builds to those versions.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 2f1450f Commit Preview URL

Branch Preview URL
Oct 29 2026, 06:25 PM

Drops image/apko.lock.json and image:lock: a release picks up Wolfi's fixes without a lock to refresh. The tag's provenance attestation records which commit and workflow built its image, and image:push still publishes only the image the smoke test ran.
… source

melange builds both architectures at once from one source directory, and one build's probe file could vanish while the other copied the directory, failing about one local image:build in four.
@sweepies
sweepies merged commit e888d6c into main Oct 29, 2026
22 checks passed
@sweepies
sweepies deleted the capy/apko-image branch October 29, 2026 19:15
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