mirror of
https://github.com/katanemo/plano.git
synced 2026-06-08 14:55:14 +02:00
Publish both arm64 and amd64 in docker on main (#392)
This commit is contained in:
parent
962727f244
commit
fa089ef32d
1 changed files with 76 additions and 19 deletions
95
.github/workflows/docker-push.yml
vendored
95
.github/workflows/docker-push.yml
vendored
|
|
@ -1,40 +1,97 @@
|
||||||
name: Publish Docker image
|
name: Publish Docker image
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE: katanemo/archgw
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
push:
|
||||||
types: [published]
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
push_to_registry:
|
# Build ARM64 image on native ARM64 runner
|
||||||
name: Push Docker image to Docker Hub
|
build-arm64:
|
||||||
runs-on: ubuntu-latest
|
runs-on: [linux-arm64]
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
contents: read
|
|
||||||
attestations: write
|
|
||||||
id-token: write
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
- name: Log in to Docker Hub
|
||||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: katanemo/archgw
|
images: ${{ env.DOCKER_IMAGE }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest # Force the tag to be "latest"
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and Push ARM64 Image
|
||||||
id: push
|
uses: docker/build-push-action@v5
|
||||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
|
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./arch/Dockerfile
|
file: ./arch/Dockerfile
|
||||||
|
platforms: linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}-arm64
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
# Build AMD64 image on GitHub's AMD64 runner
|
||||||
|
build-amd64:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.DOCKER_IMAGE }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest # Force the tag to be "latest"
|
||||||
|
|
||||||
|
- name: Build and Push AMD64 Image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./arch/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}-amd64
|
||||||
|
|
||||||
|
|
||||||
|
# Combine ARM64 and AMD64 images into a multi-arch manifest
|
||||||
|
create-manifest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build-arm64, build-amd64] # Wait for both builds
|
||||||
|
steps:
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.DOCKER_IMAGE }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest # Force the tag to be "latest"
|
||||||
|
|
||||||
|
- name: Create Multi-Arch Manifest
|
||||||
|
run: |
|
||||||
|
# Combine the architecture-specific images into a "latest" manifest
|
||||||
|
docker buildx imagetools create -t ${{ steps.meta.outputs.tags }} \
|
||||||
|
${{ env.DOCKER_IMAGE }}:latest-arm64 \
|
||||||
|
${{ env.DOCKER_IMAGE }}:latest-amd64
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue