Skip to content
Permalink
Browse files
Add support for building image using ARM hardware
  • Loading branch information
potiuk committed Mar 20, 2022
1 parent 5571d29 commit c392c13fde39bd3822a650c7840885f4cc8bcdb5
Showing 2 changed files with 68 additions and 5 deletions.
@@ -30,8 +30,71 @@ sudo -u runner mkdir -pv "${plugins_dir}"
sudo -u runner curl -L "https://github.com/docker/buildx/releases/download/${buildx_version}/${buildx_binary}" -o "${plugins_dir}/docker-buildx"
sudo -u runner chmod a+x "${plugins_dir}/docker-buildx"

apt install -y qemu qemu-user-static

# make sure multi-platform support is added for self-hosted runners
# See; https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images
sudo docker run --privileged --rm tonistiigi/binfmt --install all
## Support for multi-platform builds
## See; https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images
## We do not need installing qemu support for public runners as we are currently starting ARM instances to
## build the images for ARM
# apt install -y qemu qemu-user-static
# sudo docker run --privileged --rm tonistiigi/binfmt --install all


## Alternatively support builds with ARM instance launched on demand
# Needed Launch arm instances and make the docker engine available via forwarded SSH connection
apt-get install -y autossh
# The runner role has to have the following policies enabled:
# RunInstancesPolicy:
#{
# "Version": "2012-10-17",
# "Statement": [
# {
# "Sid": "VisualEditor0",
# "Effect": "Allow",
# "Action": [
# "ec2:AuthorizeSecurityGroupIngress",
# "ec2:TerminateInstances",
# "ec2:CreateTags",
# "ec2:RunInstances",
# "ec2:RevokeSecurityGroupIngress"
# ],
# "Resource": [
# "arn:aws:ec2:us-east-2:827901512104:subnet/*",
# "arn:aws:ec2:us-east-2:827901512104:instance/*",
# "arn:aws:ec2:us-east-2:827901512104:security-group/*",
# "arn:aws:ec2:us-east-2:827901512104:network-interface/*",
# "arn:aws:ec2:us-east-2:827901512104:volume/*",
# "arn:aws:ec2:us-east-2::image/*"
# ]
# },
# {
# "Sid": "VisualEditor1",
# "Effect": "Allow",
# "Action": [
# "ec2:DescribeInstances",
# "ec2:DescribeInstanceStatus"
# ],
# "Resource": "*"
# }
# ]
#}
#
# InstanceConnectPolicy:
# {
# "Version": "2012-10-17",
# "Statement": [
# {
# "Effect": "Allow",
# "Action": [
# "ec2-instance-connect:SendSSHPublicKey"
# ],
# "Resource": [
# "arn:aws:ec2:us-east-2:827901512104:instance/*"
# ],
# "Condition": {
# "StringEquals": {
# "ec2:osuser": "ec2-user"
# }
# }
# }
# ]
# }
@@ -38,7 +38,7 @@ source "amazon-ebs" "runner_builder" {
#access_key = ""
#secret_key = ""
region = var.aws_regions[0]
ami_name = "${var.ami_name}-${var.runner_version}-v1"
ami_name = "${var.ami_name}-${var.runner_version}-v3"
ami_regions = var.aws_regions
tag {
key = "Name"

0 comments on commit c392c13

Please sign in to comment.