Skip to content

Merge pull request #79 from anveshmuppeda/dev #1

Merge pull request #79 from anveshmuppeda/dev

Merge pull request #79 from anveshmuppeda/dev #1

# .github/workflows/docker-build-push.yaml
name: K8s-Tools | All-In-One - Docker Build
on:
workflow_dispatch:
push:
branches:
- main
- dev
paths:
- 'dockerfiles/k8s-tools/allinone/Dockerfile'
jobs:
build-push-update:
runs-on: ubuntu-latest
steps:
- name: Checkout code (with all branches)
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: dev
- name: Prepare version
id: prep
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
BUILD_IMAGE=true
else
VERSION=${GITHUB_SHA::8}
BUILD_IMAGE=true
fi
BUILD_IMAGE=true
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "ALLINONEIMAGE=anvesh35/allinone:$VERSION" >> $GITHUB_ENV
echo "LATESTALLINONEIMAGE=anvesh35/allinone:latest" >> $GITHUB_ENV
echo "BUILD_IMAGE=$BUILD_IMAGE" >> $GITHUB_ENV
- name: Set up Docker Buildx
if: env.BUILD_IMAGE == 'true'
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
if: env.BUILD_IMAGE == 'true'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push All-In-One Docker image
if: env.BUILD_IMAGE == 'true'
uses: docker/build-push-action@v4
with:
context: dockerfiles/k8s-tools/allinone/
file: dockerfiles/k8s-tools/allinone/Dockerfile
push: true
tags: |
${{ env.ALLINONEIMAGE }}
${{ env.LATESTALLINONEIMAGE }}
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ env.VERSION }}