Skip to content

Commit 7caabaf

Browse files
authored
Use native ARM builders for container builds (#1099)
This commit replaces #1088 and attempts to build a lading multi-platform image by use of organization provided ARM native builders. Unsure if this'll work but I figure it's worth a shot. Signed-off-by: Brian L. Troutwine <[email protected]>
1 parent 9b17576 commit 7caabaf

File tree

2 files changed

+49
-7
lines changed

2 files changed

+49
-7
lines changed

.github/actionlint.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
self-hosted-runner:
2+
labels:
3+
- arm-4core-linux-ubuntu24.04

.github/workflows/container.yml

+46-7
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ env:
88
IMAGE_NAME: ${{ github.repository }}
99

1010
jobs:
11-
container:
12-
runs-on: ubuntu-20.04
11+
build:
12+
runs-on: ${{ matrix.runner }}
13+
strategy:
14+
matrix:
15+
include:
16+
- arch: amd64
17+
runner: ubuntu-20.04
18+
- arch: arm64
19+
runner: arm-4core-linux-ubuntu24.04
1320
permissions:
1421
contents: read
1522
packages: write
@@ -46,10 +53,42 @@ jobs:
4653
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
4754
with:
4855
file: Dockerfile
49-
builder: ${{ steps.buildx.outputs.name }}
56+
tags: ${{ steps.meta.outputs.tags }}-${{ matrix.arch }}
5057
push: true
51-
platforms: linux/amd64, linux/arm64
52-
tags: ${{ steps.meta.outputs.tags }}
5358
labels: ${{ steps.meta.outputs.labels }}
54-
cache-from: type=gha, scope=${{ github.workflow }}
55-
cache-to: type=gha, scope=${{ github.workflow }}
59+
cache-from: type=registry,ref=ghcr.io/datadog/lading:cache
60+
cache-to: type=registry,ref=ghcr.io/datadog/lading:cache,mode=max
61+
62+
manifest:
63+
name: Create Multi-Arch Manifest
64+
needs: build
65+
runs-on: ubuntu-20.04
66+
permissions:
67+
contents: read
68+
packages: write
69+
70+
steps:
71+
- name: Log in to Container Registry
72+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
73+
with:
74+
registry: ${{ env.REGISTRY }}
75+
username: ${{ github.actor }}
76+
password: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- name: Set up Docker Buildx
79+
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
80+
81+
- name: Extract Docker Metadata
82+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
83+
id: meta
84+
with:
85+
tags: |
86+
type=sha,format=long
87+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
88+
89+
- name: Create and Push Multiarch Manifest
90+
run: |
91+
docker buildx imagetools create \
92+
--tag ${{ steps.meta.outputs.tags }} \
93+
${{ steps.meta.outputs.tags }}-amd64 \
94+
${{ steps.meta.outputs.tags }}-arm64

0 commit comments

Comments
 (0)