Skip to content

Multi-arch Build support (#262) #1

Multi-arch Build support (#262)

Multi-arch Build support (#262) #1

Workflow file for this run

name: Build and Push Image for Multi-Arch CI- Additional support for s390x & Power along with arm64 & amd64
on:
workflow_dispatch:
push:
branches:
- main
- 'release-[0-9]+\.[0-9]+\.[0-9]+'
tags:
- 'latest'
- 'v*'
env:
IMAGE_NAME: "odh-model-controller"
REPO_NAME: "opendatahub"
REGISTRY_NAME: "quay.io"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Set Docker Tag
run: |
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
echo "TAG=latest" >> $GITHUB_ENV
elif [[ "${GITHUB_REF}" == refs/heads/release-* ]]; then
VERSION="${GITHUB_REF#refs/heads/release-}"
echo "TAG=v${VERSION}-latest" >> $GITHUB_ENV
elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
echo "TAG=${TAG}" >> $GITHUB_ENV
else
echo "Branch or tag is not found. Image can't be pushed. Please check and try again!!"
exit 1
fi
- name: Build and push controller image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
context: .
file: Containerfile
push: true
tags: |
${{ env.REGISTRY_NAME }}/${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
debug: true