From 54b097ac3e0e5631913b114e7b8ed36e546b5f26 Mon Sep 17 00:00:00 2001
From: Christian Glombek <cglombek@redhat.com>
Date: Mon, 7 Jun 2021 15:37:28 +0200
Subject: [PATCH] images/alpine: Build for arm64

This commit adds a Google Cloud Build definition for building alpine
arm64 images and pushing them as a manifest list together with their
amd64 counterparts.
---
 images/alpine/cloudbuild.yaml | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/images/alpine/cloudbuild.yaml b/images/alpine/cloudbuild.yaml
index c41db9640b928..54e9292985d85 100644
--- a/images/alpine/cloudbuild.yaml
+++ b/images/alpine/cloudbuild.yaml
@@ -9,11 +9,29 @@ steps:
     dir: .
   - name: gcr.io/cloud-builders/docker
     args:
-    - tag
+    - build
+    - -t
+    - gcr.io/$PROJECT_ID/alpine:$_GIT_TAG-arm64
+    - --build-arg=ARCH=arm64
+    - --build-arg=IMAGE_ARG=gcr.io/$PROJECT_ID/alpine:$_GIT_TAG-arm64
+    - .
+  - name: 'gcr.io/cloud-builders/docker'
+    env: ['DOCKER_CLI_EXPERIMENTAL=enabled']
+    args: 
+    - manifest
+    - create
+    - gcr.io/$PROJECT_ID/alpine:latest
     - gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
+    - gcr.io/$PROJECT_ID/alpine:$_GIT_TAG-arm64
+  - name: 'gcr.io/cloud-builders/docker'
+    env: ['DOCKER_CLI_EXPERIMENTAL=enabled']
+    args: 
+    - manifest
+    - push
     - gcr.io/$PROJECT_ID/alpine:latest
 substitutions:
   _GIT_TAG: '12345'
 images:
   - 'gcr.io/$PROJECT_ID/alpine:$_GIT_TAG'
+  - 'gcr.io/$PROJECT_ID/alpine:$_GIT_TAG-arm64'
   - 'gcr.io/$PROJECT_ID/alpine:latest'