How to select x86_64 vs aarch64 in Google Cloud Build?

I’m using Google Cloud Build to generate binary artifacts that I deploy to N1 series VMs. For years, I’ve done this by setting my cloudbuild.yaml to gcr.io/cloud-builders/docker and then, in the Dockerfile, selecting the base image corresponding to the OS of my VM, such as FROM rockylinux:9.

Currently, both Google Cloud Build and my VMs are x86_64, so the artifacts can be deployed without issue. However, many of the new GCP machine types, such as C4A, use ARM architecture.

In my cloudbuild.yaml, I currently set machineType to N1_HIGHCPU_8. However, there is no option to select an ARM-based machine. The only other option is for E2 machines, where the platform is unspecified.

I could probably figure out how to cross-compile by setting flags in gcc, etc, but it is a complicated build across multiple build systems, and I would prefer to just build on the target architecture.

So, how can I run Google Cloud Build jobs in an aarch64 environment?

Read more here: Source link