plano/.github/workflows/docker-push.yml
Adil Hafeez 6486b0b1d4
latest
2025-02-04 14:46:10 -08:00

91 lines
2.6 KiB
YAML

name: Publish Docker image
on:
push:
branches:
- main # Run tests on pushes to the main branch
pull_request:
jobs:
# Build ARM64 image on native ARM64 runner
build-arm64:
runs-on: [linux-arm64]
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: katanemo/archgw
- name: Build and Push ARM64 Image
uses: docker/build-push-action@v5
with:
context: .
file: ./arch/Dockerfile
platforms: linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}-arm64
# 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: katanemo/archgw
- 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: katanemo/archgw # Correct repository name
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 }} \
katanemo/archgw:latest-arm64 \
katanemo/archgw:latest-amd64