Optimize Your CI/CD Pipeline
Get instant insights into your CI/CD performance and costs. Reduce build times by up to 45% and save on infrastructure costs.
name: ci
on:
push:
branches: main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: QEMU install
uses: docker/setup-qemu-action@v3
- name: Install Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: myuser/myrepo:latest
setup-qemu-action
GitHub Action to install QEMU static binaries
The docker/setup-qemu-action
is a GitHub Action that sets up QEMU static binaries to enable multi-platform builds within Docker workflows. This action is most helpful in setting up the environments that need to build Docker images for different architectures.
How to Configure
-
Tailscale Version You can pin the version of Tailscale you'd like to use:
- name: Install QEMU
uses: docker/setup-qemu-action@v3
with:
version: 1.52.0 -
Custom Inputs
image
: The Docker image containing QEMU static binaries. Defaults totonistiigi/binfmt:latest
.platforms
: A comma-separated list of platforms to install (e.g.,arm64,riscv64,arm
). Defaults toall
.
-
Outputs
platforms
: A comma-separated list of available platforms.
Example Workflow
Below is an example of a workflow where the QEMU setup is added to the multi-platform build of Docker:
name: Multi-Platform Build
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: QEMU Configuration
uses: docker/setup-qemu-action@v3
- name: Install Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login into DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: myuser/myrepo:latest
The included configuration YAML sets up QEMU and Docker Buildx, which means you can very smoothly build multi-platform builds in your CI/CD without struggle. This allows for a setup that ensures varied architectures are built and pushed to Docker images of constant quality and performance on all the platforms.