The Docker build-push-action
project supports multiple platforms, allowing users to build and push images for different architectures. This can be achieved using Docker Buildx and Moby BuildKit.
Quoting from the Getting Started documentation on Cloud Native Buildpacks, “BuildKit is an optimizing builder tool that can be used to build images in a variety of ways, including with Docker, with the standalone BuildKit invocation, and with the standalone Buildx tool.”
To build images for multiple architectures, you can use the buildx
command with the --platform
flag. For example, to build an image for both linux/amd64
and linux/arm64
platforms, you can use the following command:
docker buildx build --platform linux/amd64,linux/arm64 -t my-image:latest .
This command will build the image for both platforms and tag them with the my-image:latest
label.
To utilize QEMU emulation, you can use the docker buildx
command with the --load
flag. This flag will load the built images into your local Docker daemon. For example, to build and load an image for the linux/arm64
platform using QEMU emulation, you can use the following command:
docker buildx build --platform linux/arm64 --load -t my-image:latest .
This command will build the image for the linux/arm64
platform using QEMU emulation and load it into your local Docker daemon.
For more information on the buildx
command and its flags, you can refer to the official Docker documentation on GitHub Actions.
In addition to the above, the build-push-action
project also supports customizing the build process using buildpacks. Buildpacks are scripts that transform application source code into runnable artifacts that can be packaged into a container. The build-push-action
project uses the Cloud Native Buildpacks specification, which defines the interface between a buildpack and the environment that runs it.
For more information on buildpacks and the Cloud Native Buildpacks specification, you can refer to the official documentation on the Cloud Native Buildpacks website.
In summary, the build-push-action
project supports building images for multiple architectures using Docker Buildx and Moby BuildKit, and allows for customizing the build process using buildpacks. The project follows the Cloud Native Buildpacks specification, which defines the interface between a buildpack and the environment that runs it.