One of melange’s headline features is that it builds for multiple CPU architectures out of the box. When you runDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/chainguard-dev/melange/llms.txt
Use this file to discover all available pages before exploring further.
melange build, it iterates over every supported architecture and produces a separate set of APK files for each one — all without requiring you to write cross-compilation logic in your pipelines. QEMU user-mode emulation handles running foreign-architecture binaries transparently.
Supported architectures
melange can target the following architectures:| Architecture | Description |
|---|---|
x86_64 | 64-bit x86 (Intel/AMD) |
aarch64 | 64-bit ARM (Apple Silicon, AWS Graviton, etc.) |
armv7 | 32-bit ARMv7 |
arm/v6 | 32-bit ARMv6 |
ppc64le | 64-bit POWER, little-endian |
s390x | IBM Z (mainframe) |
386 | 32-bit x86 |
Default behaviour: build for all architectures
Ifpackage.target-architectures is empty (or omitted), melange builds for every architecture in the list above:
Targeting specific architectures
At the command line
Pass--arch with a comma-separated list to restrict a build to one or more architectures:
In the YAML file
Setpackage.target-architectures to restrict the build configuration itself:
The
--arch flag overrides target-architectures when both are specified. Use the YAML field when a package genuinely cannot be built for certain architectures (e.g., it contains architecture-specific assembly).How QEMU emulation works
When melange builds for an architecture that differs from the host CPU, it relies on binfmt_misc kernel support to transparently execute foreign-architecture ELF binaries through QEMU user-mode emulation. From the pipeline’s perspective, nothing changes —./configure && make works the same whether the build is native or emulated. melange does not require cross-compilation toolchains, sysroots, or CROSS_COMPILE environment variables.
Architecture substitutions in pipelines
Use the built-in substitution variables to write architecture-aware pipeline steps without hardcoding values:| Variable | Example value | Description |
|---|---|---|
${{build.arch}} | aarch64 | melange architecture name |
${{build.goarch}} | arm64 | Go’s GOARCH equivalent |
Choosing a runner
melange supports three runners for executing pipeline steps. The right choice depends on your host operating system and whether you need to build for foreign architectures.bubblewrap
Linux only. Uses
bwrap to create a lightweight container from the guest directory. Fastest option on Linux; no Docker daemon required. The default on Linux hosts.docker
Linux and macOS. Runs pipeline steps inside a Docker container. Requires Docker Desktop or a Docker daemon. The default on macOS hosts and any non-Linux platform.
qemu
Full VM. Boots a QEMU virtual machine for each build. Required for strict isolation or when
binfmt_misc is not available. Slower than bubblewrap but most portable.--runner:
When to use which runner
| Scenario | Recommended runner |
|---|---|
| Linux CI/CD, maximum speed | bubblewrap |
| macOS local development | docker or qemu |
| Strict sandbox isolation | qemu |
| Docker already in use | docker |
| No Docker daemon available | bubblewrap (Linux) or qemu |
Using the Docker container image for multi-arch builds
The official melange container image supports multi-architecture builds when run with Docker:--privileged flag is required to allow binfmt_misc registration and bubblewrap to function inside the container. To build only for the current host architecture:
