Skip to content

Share the game layer between the amd64 and arm64 images - #59

Merged
lagergren merged 1 commit into
mainfrom
lagergren/docker-copy-link
Nov 7, 2026
Merged

lagergren merged 1 commit into
mainfrom
lagergren/docker-copy-link

Conversation

@lagergren

Copy link
Copy Markdown
Owner

What

The bitmap image stores the game once per release instead of twice. In 0.9.2, the amd64 and arm64 images each carry their own 184 MB game layer, with different digests for the same jars, so ghcr.io holds 368 MB of game per release. COPY --link makes both platforms share one layer.

Why the copies differed

The release builds the amd64 image on its own for the smoke test, then builds both platforms, reusing that amd64 build. A plain COPY layer is diffed against the image under it, so it records /app as it was in each platform's build, built minutes apart. That gives two layers with the same files but different digests, along with two different WORKDIR layers, as in 0.9.2. COPY --link builds the layer on its own, independent of the image under it.

Testing

  • BuildKit, the builder CI uses: a small Dockerfile of the same shape, run in the release's order (amd64 alone, then both platforms on the same cache), built with moby/buildkit v0.23.2:
    • without --link, amd64 and arm64 get different game layers, as in 0.9.2;
    • with --link, they share one layer.
  • Podman, which ./rylween serve uses without Docker: builds the real Dockerfile.bitmap with --link. The image serves /healthz, the login page, and prints its link.

Releases after this one still add a new game layer each time, since the paintings and audio ship inside the game jar. Moving them into their own layer is a separate change.

The release builds the amd64 image for its smoke test first, then both
platforms, reusing that amd64 build. The game's COPY layer was diffed
against each platform's JRE, so the two copies of the same 184 MB of jars
got different digests, and ghcr.io stored the game twice per release, as
0.9.2 shows. COPY --link builds the layer on its own, so both platforms
use one blob. Podman builds the image with --link too.
@lagergren
lagergren merged commit 286e36a into main Nov 7, 2026
1 check passed
@lagergren
lagergren deleted the lagergren/docker-copy-link branch November 7, 2026 18:29
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