Re-introduce kdump debugger container cloudbuild

kdump_debugger container builds take over 1 hr on cloudbuild and often
stalled builds for other containers in automated CI. For this reason,
the automated builds for kdump were discontinued.

This change brings back time to under 10 minutes, by not building the
crash utility from source.

1. Install crash using apt-get.
2. Change ubuntu from focal to impish to capture latest crash version
3. re-introduce cloudbuild config with qemu6+ for multi-arch support

BUG=b/194525262

Change-Id: Ib7c697e77c888ee36279f715170ff554ee2cd593
Reviewed-on: https://cos-review.googlesource.com/c/cos/tools/+/28560
Cloud-Build: GCB Service account <228075978874@cloudbuild.gserviceaccount.com>
Reviewed-by: Oleksandr Tymoshenko <ovt@google.com>
Tested-by: Arnav Kansal <rnv@google.com>
diff --git a/src/cmd/cos_kdump_debugger/Dockerfile b/src/cmd/cos_kdump_debugger/Dockerfile
index af990eb..f959564 100644
--- a/src/cmd/cos_kdump_debugger/Dockerfile
+++ b/src/cmd/cos_kdump_debugger/Dockerfile
@@ -1,26 +1,11 @@
 # Start from ubuntu
-FROM ubuntu:latest
+FROM ubuntu:impish
 
 RUN apt-get update
 
 ARG DEBIAN_FRONTEND=noninteractive
-# This is required because of https://github.com/crash-utility/crash/issues/74
-RUN apt update && BUILD_DEPS="binutils binutils-dev bison gawk \
-    flex zlib1g-dev libncurses5-dev liblzo2-dev libsnappy-dev \
-    make wget git" \
-    && apt-get install -y --ignore-missing $BUILD_DEPS \
-    && git clone -b 7.2.9 https://github.com/crash-utility/crash.git /tmp/crash \
-    && git config --global user.email "foo@bar.local" \
-    && git config --global user.name "Foo Bar" \
-    && git -C /tmp/crash cherry-pick a5531b2 71e159c \
-    && make -C /tmp/crash extensions lzo snappy \
-    && mkdir -p /usr/lib/crash/extensions/ \
-    && cp -f /tmp/crash/crash /usr/bin \
-    && cp -f /tmp/crash/extensions/*.so /usr/lib/crash/extensions/ \
-    && strip /usr/bin/crash /usr/lib/crash/extensions/*.so \
-    && rm -rf /tmp/crash \
-    && apt-get purge -y --auto-remove $BUILD_DEPS
-RUN apt-get install -y -qq --no-install-recommends gdb xz-utils python curl vim \
+
+RUN apt-get install -y -qq --no-install-recommends crash gdb xz-utils curl vim \
       liblzo2-2 libsnappy1v5 zlib1g libncurses5 binutils apt-transport-https ca-certificates gnupg
 
 # Installs gsutil, following:
diff --git a/src/cmd/cos_kdump_debugger/cloudbuild.yaml b/src/cmd/cos_kdump_debugger/cloudbuild.yaml
new file mode 100644
index 0000000..aab980b
--- /dev/null
+++ b/src/cmd/cos_kdump_debugger/cloudbuild.yaml
@@ -0,0 +1,30 @@
+options:
+  env:
+  - 'DOCKER_CLI_EXPERIMENTAL=enabled'
+  machineType: 'N1_HIGHCPU_8'
+steps:
+# Build kdump debugger image
+# This step is needed to add a new entry to /proc/sys/fs/binfmt_misc. Docker
+# uses QEMU user emulation to run arm64 programs on x86 hosts. A QEMU
+# interpreter needs to be added to /proc/sys/fs/binfmt_misc to run arm64
+# programs. Use tonistiigi/binfmt over linuxkit/binfmt to resolve ARM64 seg faults
+# relating to libc-bin while installing crash-7.3.0. This change essentially
+# swaps the host qemu to qemu v6+.
+- name: 'gcr.io/cloud-builders/docker'
+  args: ['run', '--privileged', '--rm' ,'tonistiigi/binfmt', '--uninstall','qemu-*']
+- name: 'gcr.io/cloud-builders/docker'
+  args: ['run', '--privileged', '--rm', 'tonistiigi/binfmt', '--install', 'all']
+# The default builder (which appears to be the Docker daemon that implements
+# the old, familiar `docker build` behavior) doesn't support the --platform
+# flag, so we need to create a new builder.
+- name: 'gcr.io/cloud-builders/docker'
+  args: ['buildx', 'create', '--name', 'builder']
+- name: 'gcr.io/cloud-builders/docker'
+  args: ['buildx', 'use', 'builder']
+# Images produced in this way do not appear in the Docker image registry shown
+# by `docker images`, at least by default. We use the --push flag to push the
+# image after building it, because a subsequent `docker push` won't find the
+# image locally.
+- name: 'gcr.io/cloud-builders/docker'
+  args: ['buildx', 'build', '--platform', 'linux/amd64,linux/arm64', '-f', 'src/cmd/cos_kdump_debugger/Dockerfile', '-t', 'gcr.io/${_OUTPUT_PROJECT}/cos_kdump_debugger:latest', '-t', 'gcr.io/${_OUTPUT_PROJECT}/cos_kdump_debugger:${TAG_NAME}', '--push', 'src/cmd/cos_kdump_debugger']
+timeout: 1800s