Skip to content

Commit

Permalink
Merge branch 'loxilb-io:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
backguynn authored Aug 7, 2024
2 parents a0b4446 + a9c0114 commit fc92249
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 23 deletions.
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 }}
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
FROM golang:1.22-alpine AS builder

RUN apk update && apk add git && apk add make

WORKDIR /usr/src/app
COPY . .

RUN make build

FROM golang:1.21

LABEL name="kube-loxilb" \
Expand All @@ -9,6 +18,7 @@ LABEL name="kube-loxilb" \
maintainer="backguyn@netlox.io"

WORKDIR /bin/
COPY ./bin/kube-loxilb /bin/kube-loxilb
COPY --from=builder /usr/src/app/bin/kube-loxilb /bin/kube-loxilb

USER root
RUN chmod +x /bin/kube-loxilb

0 comments on commit fc92249

Please sign in to comment.