Skip to main content
← Back to list
01Issue
FeatureShippedExtensionsPublic
Assigneesstack72

Relationships

#3683 @swamp/container-image: platform input on build; Apple Containers can build multi-platform

Opened by dmc · 10/20/2026· Shipped 10/22/2026

Problem

Two related gaps make it hard to build for a non-host platform:

  1. build cannot choose a platform. BuildArgsSchema has no platform field, and buildBuildArgv never adds --platform, so build always targets the host architecture. On an Apple-silicon Mac, build cannot produce a single-arch linux/amd64 image with any runtime.

  2. multi-platform-build blocks Apple Containers based on an outdated premise. The multi-platform-available check (and the README matrix) says Apple Containers "can only build for the host architecture (arm64) — it has no cross-compilation support for multi-platform manifests". That is no longer true. Tested with Apple container 1.5.0 (Homebrew, macOS 26, Apple silicon):

    • container build --platform linux/amd64 … → a linux/amd64 image (Rosetta).
    • container build --platform linux/amd64 --platform linux/arm64 -t multi-test:platform . → one image index with both linux/amd64 and linux/arm64. Running each variant: amd64 → uname -m = x86_64, arm64 → aarch64.
    • container build --arch amd64 --arch arm64 … → the same two-platform index.
    • container build --help: --platform <platform> Add the platform to the build (format: os/arch[/variant] …) [environment: CONTAINER_DEFAULT_PLATFORM].

    Not tested: whether container image push pushes the whole multi-platform index.

Use case: building a bootc OS image (FROM quay.io/centos-bootc/centos-bootc:stream10) for x86_64 Proxmox VMs from an arm64 laptop with binary: container.

Current workaround: run swamp with CONTAINER_DEFAULT_PLATFORM=linux/amd64 in the environment. The extension passes the environment through, and oci-build::build then produces linux/amd64. This works, but it applies to the whole swamp process, not to one step, so it does not fit a workflow that builds for more than one platform.

Proposed solution

  1. build: add an optional platform.

    • BuildArgsSchema: platform: safeOptionValue("platform").optional().describe("Target platform (e.g. 'linux/amd64'). Defaults to the host platform.")
    • buildBuildArgv: if (args.platform) argv.push("--platform", args.platform); — docker build, podman build and container build all accept --platform os/arch.
    • BuildResultSchema: add platform: z.string().optional().
    • No behavior change when platform is omitted.
  2. multi-platform-build: support binary: container.

    • Allow container in checkBuildxAvailable.
    • Argv: container build with one --platform <p> per entry in platforms, -t <tag> per tag, then container image push <tag> when push is true (checking that the pushed digest is the index digest).
    • Update the README runtime matrix and the method description ("Not available for Apple Containers").

Alternatives considered

  • A local export const extension cannot add an input to build: the base type's own member always wins.
  • A new method name (e.g. build-for-platform) duplicates the build argv code.
  • CONTAINER_DEFAULT_PLATFORM: works for one platform per process only (see above).

Environment

  • @swamp/container-image 2026.10.13.1 (model 2026.08.25.2)
  • swamp 20261016.142354.0
  • Apple container 1.5.0 (Homebrew), macOS 26, Apple silicon

Upstream repository: https://github.com/swamp-club/swamp-extensions

Environment

  • Extension: @swamp/container-image@2026.10.13.1
  • swamp: 20261020.171730.0-sha.f469323c
  • OS: darwin (aarch64)
  • Deno: 2.9.7
  • Shell: /bin/zsh
02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 7 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

10/22/2026, 1:23:29 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack7210/21/2026, 11:46:44 PM
Editable. Press Enter to edit.

system commented 10/20/2026, 7:21:24 PM

Classified automatically when this issue was filed.

  • Source: Extensions

If you feel this classification is incorrect, add a ripple to tell us so.

stack72 commented 10/22/2026, 1:23:32 AM

Thanks @dmc for reporting this! We shipped: Add an optional platform input to build (emits --platform, recorded in buildResult, passed through to docker OCI export) and let multi-platform-build run with Apple Containers via container build with repeated --platform flags plus container image push per tag. Lift the outdated host-arch-only block in checkBuildxAvailable and defaultBuildxProbe, update docs, bump versions.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.