mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
Reduce Docker builds from 10 to 1 per PR by building the image once and sharing it as an artifact across all dependent jobs. Merge duplicate Docker Hub and GHCR push workflows into single workflows that push to both registries per build. - ci.yml: replaces pre-commit, rust_tests, validate_plano_config, plano_tools_tests, docker-security-scan, e2e_tests, e2e_plano_tests, e2e_test_preference_based_routing, e2e_test_currency_convert - docker-push-main.yml: replaces old docker-push-main + ghrc-push-main - docker-push-release.yml: replaces old docker-push-release + ghrc-push-release - static.yml and publish-pypi.yml unchanged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
109 lines
3 KiB
YAML
109 lines
3 KiB
YAML
name: Publish docker image (latest)
|
|
|
|
env:
|
|
DOCKER_IMAGE: katanemo/plano
|
|
GHCR_IMAGE: ghcr.io/${{ github.repository_owner }}/plano
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
# Build ARM64 image on native ARM64 runner — push to both registries
|
|
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: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and Push ARM64 Image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/arm64
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKER_IMAGE }}:latest-arm64
|
|
${{ env.GHCR_IMAGE }}:latest-arm64
|
|
|
|
# Build AMD64 image on GitHub's AMD64 runner — push to both registries
|
|
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: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and Push AMD64 Image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKER_IMAGE }}:latest-amd64
|
|
${{ env.GHCR_IMAGE }}:latest-amd64
|
|
|
|
# Combine ARM64 and AMD64 images into multi-arch manifests for both registries
|
|
create-manifest:
|
|
runs-on: ubuntu-latest
|
|
needs: [build-arm64, build-amd64]
|
|
steps:
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create Docker Hub Multi-Arch Manifest
|
|
run: |
|
|
docker buildx imagetools create \
|
|
-t ${{ env.DOCKER_IMAGE }}:latest \
|
|
${{ env.DOCKER_IMAGE }}:latest-arm64 \
|
|
${{ env.DOCKER_IMAGE }}:latest-amd64
|
|
|
|
- name: Create GHCR Multi-Arch Manifest
|
|
run: |
|
|
docker buildx imagetools create \
|
|
-t ${{ env.GHCR_IMAGE }}:latest \
|
|
${{ env.GHCR_IMAGE }}:latest-arm64 \
|
|
${{ env.GHCR_IMAGE }}:latest-amd64
|