Skip to content

Commit

Permalink
Use native ARM builders for container builds (#1099)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
blt authored Nov 7, 2024
1 parent 9b17576 commit 7caabaf
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
self-hosted-runner:
labels:
- arm-4core-linux-ubuntu24.04
53 changes: 46 additions & 7 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
container:
runs-on: ubuntu-20.04
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-20.04
- arch: arm64
runner: arm-4core-linux-ubuntu24.04
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -46,10 +53,42 @@ jobs:
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ steps.meta.outputs.tags }}-${{ matrix.arch }}
push: true
platforms: linux/amd64, linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
cache-from: type=registry,ref=ghcr.io/datadog/lading:cache
cache-to: type=registry,ref=ghcr.io/datadog/lading:cache,mode=max

manifest:
name: Create Multi-Arch Manifest
needs: build
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write

steps:
- name: Log in to Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1

- name: Extract Docker Metadata
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
id: meta
with:
tags: |
type=sha,format=long
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Create and Push Multiarch Manifest
run: |
docker buildx imagetools create \
--tag ${{ steps.meta.outputs.tags }} \
${{ steps.meta.outputs.tags }}-amd64 \
${{ steps.meta.outputs.tags }}-arm64

0 comments on commit 7caabaf

Please sign in to comment.