Skip to content

add docker build and push github workflow #1

add docker build and push github workflow

add docker build and push github workflow #1

name: Docker Build and Push
on: [ push, pull_request ]
jobs:
build-docker-image:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
name: Build Docker Image
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Fetch Sources
uses: actions/checkout@v4.2.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha
type=sha,format=long
type=raw,latest
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
GIT_HASH=${{ github.GITHUB_SHA }}
REPOSITORY_USERNAME=${{ secrets.REPOSITORY_USERNAME }}
REPOSITORY_PASSWORD=${{ secrets.REPOSITORY_PASSWORD }}
platforms: linux/arm64,linux/amd64
no-cache: true