Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use native ARM builders for container builds #1099

Merged
merged 12 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading