Skip to content

Commit

Permalink
Add github actions for building image
Browse files Browse the repository at this point in the history
  • Loading branch information
crazytaxii committed Jan 27, 2024
1 parent bcf634a commit 20d8b34
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Docker Image CI

on:
push:
branches:
- main

env:
GO_VERSION: "1.20.11"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get short commit hash
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login in dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push the image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ env.COMMIT_HASH }}
GOVERSION=${{ env.GO_VERSION }}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/volume-qos-controller:latest
${{ secrets.DOCKERHUB_USERNAME }}/volume-qos-controller:${{ env.COMMIT_HASH }}

0 comments on commit 20d8b34

Please sign in to comment.