Files
TK-Wiki-Newsletter/.gitea/workflows/docker-build.yml
smueller 1674efd587 Enhance Docker build workflow by adding virtual environment setup
- Introduced a Python virtual environment for dependency management.
- Updated pip installation commands to use the virtual environment context.
2026-07-09 10:55:25 +02:00

66 lines
1.9 KiB
YAML

name: Docker Image bauen & veröffentlichen
on:
# Kein Build auf Branch-Pushes (dev/main).
# Build nur, wenn ein Versions-Tag (v*) gesetzt wird
# -> also beim Release-Merge dev -> main inkl. Tag.
push:
tags:
- "v*"
workflow_dispatch:
env:
# Host der Gitea Container Registry (bei Bedarf als Repo-Variable REGISTRY überschreiben)
REGISTRY: ${{ vars.REGISTRY || 'git.hexahost.dev' }}
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Repository auschecken
uses: actions/checkout@v4
- name: Python-Abhängigkeiten prüfen (pip-audit)
run: |
python -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install pip-audit
pip-audit -r requirements.txt
- name: Docker Buildx einrichten
uses: docker/setup-buildx-action@v3
- name: An Gitea Container Registry anmelden
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER || github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Metadaten (Tags & Labels) bestimmen
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,format=short
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Image bauen & pushen
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}