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

PR : added gh-action for multi-arch build #161

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Changes from all 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
59 changes: 37 additions & 22 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@ on:
description: 'Tag Name'
required: true
default: 'latest'

jobs:

build:
runs-on: ubuntu-latest
name: docker-ci

runs-on: ubuntu-20.04
permissions:
packages: write

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.0'

#- name : Checkout Branch
# if: github.event.inputs.tagName != ''
# run: |
# git fetch --all --tags
# git checkout ${{ github.event.inputs.tagName }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
Expand All @@ -33,25 +30,43 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the kube-loxilb image
run: make
# Setup hardware emulator using QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Build the latest loxilb Docker image
if: github.event.inputs.tagName == ''
run: docker build . --tag ghcr.io/loxilb-io/kube-loxilb:latest
# Setup Docker Buildx for multi-arch images
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build the kube-loxilb Docker image with given tag
if: github.event.inputs.tagName != ''
run: docker build . --tag ghcr.io/loxilb-io/kube-loxilb:${{ github.event.inputs.tagName }}
- name: Build Check
if: |
github.repository != 'loxilb-io/kube-loxilb'
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: false
tags: ghcr.io/loxilb-io/kube-loxilb:latest

- name: Publish the latest loxilb Docker image
- name: Build and push to latest
if: |
github.repository == 'loxilb-io/kube-loxilb'
&& github.event.inputs.tagName == ''
run: docker push ghcr.io/loxilb-io/kube-loxilb:latest
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: ghcr.io/loxilb-io/kube-loxilb:latest

- name: Publish the kube-loxilb Docker image with given tag
- name: Build and push to given tag
if: |
github.repository == 'loxilb-io/kube-loxilb'
&& github.event.inputs.tagName != ''
run: docker push ghcr.io/loxilb-io/kube-loxilb:${{ github.event.inputs.tagName }}
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
build-args: TAG=${{ github.event.inputs.tagName }}
tags: ghcr.io/loxilb-io/kube-loxilb:${{ github.event.inputs.tagName }}
Loading