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

fix: support arm64 architectures #94

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Changes from 3 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
66 changes: 56 additions & 10 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,33 @@ on:
types:
- published
workflow_dispatch:
inputs:
release_tag:
description: "Release tag version to tag image, e.g. v0.1.1"
required: true
type: string

jobs:
get-release-tag:
name: Get release tag
runs-on: ubuntu-latest
steps:
- name: Get release tag
id: get_release_tag
run: echo "::set-output name=release_tag::${{ github.event.release.tag_name || github.event.inputs.release_tag }}"

build-and-push:
name: Build and push docker image
runs-on: ubuntu-latest
needs: get-release-tag
strategy:
matrix:
os: [ubuntu-latest, ARM64]
include:
- os: ubuntu-latest
build-platform: linux/amd64
- os: ARM64
build-platform: linux/arm64
runs-on: ${{ matrix.os }}

steps:
- name: checkout code
Expand All @@ -35,16 +57,40 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

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

- name: Build with Poetry
run: make build-wheel

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
ghcr.io/${{ github.repository }}:latest
- name: Build Docker image
run: |
docker buildx build \
--platform ${{ matrix.build-platform }} \
--output type=docker \
-t ghcr.io/${{ github.repository }}:${{ needs.get-release-tag.outputs.release_tag }}-${{ matrix.build-platform }} \
.

- name: Push Docker image
run: |
docker push ghcr.io/${{ github.repository }}:${{ needs.get-release-tag.outputs.release_tag }}-${{ matrix.build-platform }}

manifest:
name: Create and push multi-architecture manifest
needs: get-release-tag, build-and-push
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifest
run: |
docker buildx imagetools create \
-t ghcr.io/${{ github.repository }}:${{ needs.get-release-tag.outputs.release_tag }} \
-t ghcr.io/${{ github.repository }}:latest \
ghcr.io/${{ github.repository }}:${{ needs.get-release-tag.outputs.release_tag }}-linux/amd64 \
ghcr.io/${{ github.repository }}:${{ needs.get-release-tag.outputs.release_tag }}-linux/arm64
Loading