Skip to content

Update publish-docker.yml #14

Update publish-docker.yml

Update publish-docker.yml #14

name: Publish Docker Image
on:
push:
branches:
- master # Trigger für Development-Builds
release:
types: [published] # Trigger für Release-Builds
jobs:
build-and-push:
#runs-on: ubuntu-latest
runs-on: self-hosted
steps:
# 1. Repository-Code auschecken
- name: Check out code
uses: actions/checkout@v3
# 2. Docker-Tags basierend auf dem Event setzen
- name: Set up Docker tags
id: vars
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "TAGS=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest" >> $GITHUB_ENV
else
echo "TAGS=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:development" >> $GITHUB_ENV
fi
# 3. Bei GHCR einloggen
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 4. QEMU für Multiarch-Emulation einrichten
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
# 5. Docker Buildx einrichten
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# 6. Docker-Image bauen und pushen
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.TAGS }}
platforms: linux/amd64,linux/arm64