linuxis supported as the build platform OS. Building with Windows containers will be available in a future version of Earthly.
--platformflag across various Earthfile commands or as part of the
earthlycommand, it is possible to override the build platform and thus be able to execute builds on non-native processor architectures. Execution of non-native binaries can be performed via QEMU emulation.
RUN), QEMU needs to be installed and set up. This will allow you perform Earthly builds on non-native platforms, but also incidentally, to run Docker images on your host system through
docker run --platform=....
docker runcommand above enables execution of different multi-architecture containers by QEMU and
binfmt_misc. It only needs to be run once.
BUILD --platformflag. For example:
+buildtarget were invoked without the use of any flag, Earthly would simply perform the build on the native architecture of the host system.
+buildto execute twice, in parallel: one time on
linux/amd64and another time on
earthlybuild command. For example:
FROM --platform. For example:
earthly --push +build-all-platformsis executed, the build will push a multi-manifest image to the Docker registry. The manifest will contain two images: one for
linux/amd64and one for
linux/arm/v7. This works as such because both targets that save images use the exact same Docker tag for the image.
RUNon the target platform (and therefore emulation is not necessary):
COPYcommands. The execution of the target
+buildmay take place on the host platform (in this case,
linux/amd64) and yet produce binaries for either
arm/v7. Since there is no
RUNcommand as part of the
+build-arm-v7target, no emulation is necessary.
USERVARIANT(eg ``; an empty string for non-arm platforms)
WITH DOCKERhas an important limitation for cross-platform builds: the target containing
WITH DOCKERneeds to be executing on the native architecture of the host system. The images being run within
WITH DOCKERcan be of any architecture, however.
WITH DOCKERstarts up an isolated Docker daemon running within a container, and docker-in-docker is not yet supported in a QEMU environment.