Skip to main content

Build and push assets for arm64

This page describes how nullplatform supports building Docker assets for the ARM64 platform.

By default, Docker builds for the x86_64 platform; however, cloud providers are increasingly offering instances that use ARM platforms.

Our CI/CD tools, such as GitHub Actions, GitLab Pipelines, and Azure Pipelines, provide flexibility, allowing for default behavior and the use of custom build commands, arguments, and options.

Partial Support

Currently, nullplatform supports the ARM64 platform only for AWS.

Set up docker buildx

Docker Buildx is the utility used to build images for different target platforms. It can be set up manually using the create command:

docker buildx create --use

If using GitHub Actions, you can import the following actions to set it up:

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Build and push docker assets for arm64

Once docker buildx is set up, you need to change your build and push command to use it:

docker buildx build --platform linux/arm64 -t main --load . # create a docker image for arm64 and load it as main:latest
np asset push --type docker-image --source main # use nullplatform cli to push the asset.

The nullplatform CLI infers the target platform from the Docker image's manifest.

Build and push docker assets for multiple platforms

You can build a single application for multiple platforms by having multiple build and push steps, one for each target platform:

docker buildx build --platform linux/amd64 -t x86_64 --load .
docker buildx build --platform linux/arm64 -t arm64 --load .
np asset push --type docker-image --source x86_64 --name x86_64
np asset push --type docker-image --source arm64 --name arm64
Push Multiple Assets

When pushing multiple assets, you need to specify the --name argument to the nullplatform CLI.

Examples

Docker image asset for arm64

name: ci-nullplatform
env:
NULLPLATFORM_API_KEY: ${{ secrets.NULLPLATFORM_API_KEY }}
on:
push:
branches:
- main
- master
permissions:
id-token: write
contents: read
packages: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install nullplatform cli
run: curl https://cli.nullplatform.com/install.sh | sh
- name: Checkout code
uses: actions/checkout@v4
- name: Start nullplatform CI
run: np build start
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build arm64 asset
run: docker buildx build --platform linux/arm64 -t arm64 --load .
- name: Push arm64 asset
run: np asset push --type docker-image --source arm64
- name: End nullplatform CI
if: ${{ always() }}
run: np build update --status ${{ contains(fromJSON('["failure", "cancelled"]'), job.status) && 'failed' || 'successful' }}

Docker image asset for multiple platforms

name: ci-nullplatform
env:
NULLPLATFORM_API_KEY: ${{ secrets.NULLPLATFORM_API_KEY }}
on:
push:
branches:
- main
- master
permissions:
id-token: write
contents: read
packages: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install nullplatform cli
run: curl https://cli.nullplatform.com/install.sh | sh
- name: Checkout code
uses: actions/checkout@v4
- name: Start nullplatform CI
run: np build start
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build x86_64 asset
run: docker buildx build --platform linux/amd64 -t x86_64 --load .
- name: Build arm64 asset
run: docker buildx build --platform linux/arm64 -t arm64 --load .
- name: Push x86_64 asset
run: np asset push --type docker-image --source x86_64 --name x86_64
- name: Push arm64 asset
run: np asset push --type docker-image --source arm64 --name arm64
- name: End nullplatform CI
if: ${{ always() }}
run: np build update --status ${{ contains(fromJSON('["failure", "cancelled"]'), job.status) && 'failed' || 'successful' }}