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 1 commit
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
60 changes: 54 additions & 6 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.os }}
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 @@ -47,9 +54,50 @@ jobs:
with:
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/${{ matrix.arch }}
tags: |
${{ steps.meta.outputs.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:latest
cache-to: type=registry,ref=ghcr.io/datadog/lading:latest,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@v3.3.0
blt marked this conversation as resolved.
Show resolved Hide resolved
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
blt marked this conversation as resolved.
Show resolved Hide resolved

- name: Extract Docker Metadata
uses: docker/metadata-action@v5.5.1
blt marked this conversation as resolved.
Show resolved Hide resolved
id: meta
with:
tags: |
type=sha,format=long
type=ref,prefix=pr-,event=pr
type=semver,pattern={{version}},event=tag
type=semver,pattern={{major}}.{{minor}},event=tag
type=semver,pattern={{major}},event=tag
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Create and Push Multi-Arch Manifest
run: |
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}-amd64 \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}-arm64

docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Update the rust version in-sync with the version in rust-toolchain.toml
FROM docker.io/rust:1.81.0-bullseye AS builder
FROM --platform=$BUILDPLATFORM docker.io/rust:1.81.0-bullseye AS builder

RUN apt-get update && apt-get install -y \
protobuf-compiler fuse3 libfuse3-dev \
Expand All @@ -9,7 +9,7 @@ WORKDIR /app
COPY . /app
RUN cargo build --release --locked --bin lading

FROM docker.io/debian:bullseye-20240701-slim
FROM --platform=$BUILDPLATFORM docker.io/debian:bullseye-20240701-slim
RUN apt-get update && apt-get install -y libfuse3-dev=3.10.3-2 fuse3=3.10.3-2 && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/lading /usr/bin/lading

Expand Down
Loading