initial commit

This commit is contained in:
Stefan Koelle
2026-08-01 15:06:34 +02:00
parent 912f189e9b
commit e10a31d230
9 changed files with 384 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
name: Build and Push Docker Image
on:
push:
branches: [main]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
cleanup-old-images:
needs: build-and-push
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete old, untagged image versions
uses: actions/delete-package-versions@v5
with:
package-name: ${{ github.event.repository.name }}
package-type: container
min-versions-to-keep: 1
delete-only-untagged-versions: true