Add Docker build workflow

This commit is contained in:
veronoicc 2024-05-14 10:03:22 +02:00
parent b6b63a6c6d
commit caf18da694

37
.github/workflows/build-docker.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: build-docker
on: [push, pull_request, workflow_dispatch]
env:
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
tags: latest
images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max