Merge pull request #51 from apache/add-packer-for-arm-docker-instance

Add packer configuration to build ARM docker instance
diff --git a/github-runner-ami/packer/files/regctl.sh b/github-runner-ami/packer/files/regctl.sh
new file mode 100644
index 0000000..1a8e712
--- /dev/null
+++ b/github-runner-ami/packer/files/regctl.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+set -exu -o pipefail
+
+architecture=$(uname -m)
+if [[ ${architecture} == "x86_64" ]] ; then
+    # Well. Docker compose got it right, but regctl didn't ¯\_(ツ)_/¯
+    architecture="amd64"
+fi
+# Hard-code regctl version
+regctl_version="v0.4.3"
+regctl_binary="regctl-$(uname -s)-${architecture}"
+curl -L "https://github.com/regclient/regclient/releases/download/${regctl_version}/${regctl_binary}" -o "/usr/local/bin/regctl"
+chmod a+x "/usr/local/bin/regctl"
diff --git a/github-runner-ami/packer/ubuntu2004.pkr.hcl b/github-runner-ami/packer/ubuntu2004.pkr.hcl
index 3407c81..0983ef2 100644
--- a/github-runner-ami/packer/ubuntu2004.pkr.hcl
+++ b/github-runner-ami/packer/ubuntu2004.pkr.hcl
@@ -38,7 +38,7 @@
   #access_key = ""
   #secret_key = ""
   region = var.aws_regions[0]
-  ami_name = "${var.ami_name}-${var.runner_version}-v4"
+  ami_name = "${var.ami_name}-${var.runner_version}-v6"
   ami_regions = var.aws_regions
   tag {
     key   = "Name"
@@ -143,6 +143,7 @@
       "./files/git.sh",
       "./files/runner_bootstrap.sh",
       "./files/docker-buildx.sh",
+      "./files/regctl.sh",
       "./files/cleanup.sh",
     ]
     execute_command = "chmod +x '{{ .Path }}'; sudo sh -c '{{ .Vars }} {{ .Path }}'"
diff --git a/github-runner-ami/packer/vars/variables.pkrvars.hcl b/github-runner-ami/packer/vars/variables.pkrvars.hcl
index 2b351c5..3471ee9 100644
--- a/github-runner-ami/packer/vars/variables.pkrvars.hcl
+++ b/github-runner-ami/packer/vars/variables.pkrvars.hcl
@@ -19,5 +19,5 @@
 ami_name = "airflow-runner-ami"
 aws_regions = ["eu-central-1", "us-east-2"]
 packer_role_arn = "arn:aws:iam::827901512104:role/packer-role"
-runner_version = "2.293.0-airflow1"
+runner_version = "2.294.0-airflow1"
 session_manager_instance_profile_name = "packer_ssm_instance_profile"