refactor: update Docker workflow for ARM64 optimization and Keycloak integration

Revised `.gitea/workflows/docker-publish.yaml` to enhance ARM64 compatibility, removing QEMU setup for native builds on Zora. Added automated Keycloak builds and updated configurations (e.g., JDK 25, Gradle 9.3.1). Streamlined build arguments and JVM optimizations for Cortex-A720 architecture.
This commit is contained in:
Stefan Mogeritsch 2026-02-13 15:55:38 +01:00
parent 6c50f22773
commit 75ff2780c6

View File

@ -18,10 +18,13 @@ on:
env: env:
REGISTRY: git.mo-code.at REGISTRY: git.mo-code.at
IMAGE_PREFIX: mo-code/meldestelle # WICHTIG: Kleingeschrieben für Docker-Konformität
# Build Arguments IMAGE_PREFIX: mocode-software/meldestelle
GRADLE_VERSION: "8.5" # Build Arguments für Zora (ARM64 Power)
JAVA_VERSION: "21" JAVA_VERSION: "25"
GRADLE_VERSION: "9.3.1"
# Deine neuen JVM Power-Flags für ARM64 (Cortex-A720)
JVM_OPTS_ARM64: "-XX:ActiveProcessorCount=12 -XX:+UseG1GC -XX:+UseTransparentHugePages -XX:+UseSVE=1"
jobs: jobs:
build-and-push: build-and-push:
@ -42,19 +45,24 @@ jobs:
context: . context: .
dockerfile: config/docker/caddy/web-app/Dockerfile dockerfile: config/docker/caddy/web-app/Dockerfile
image: web-app image: web-app
# NEU: Keycloak wird jetzt auch automatisch gebaut und gepusht
- service: keycloak
context: .
dockerfile: config/docker/keycloak/Dockerfile
image: keycloak
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
# Java Setup für den Frontend Build (Gradle braucht Java) # Java Setup (Wichtig für Gradle-Builds im Runner)
- name: Set up JDK 21 - name: Set up JDK 25
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
java-version: '21' java-version: '25'
distribution: 'temurin' distribution: 'temurin'
# Cache für Gradle # Cache für Gradle (Beschleunigt Folgebauvorgänge massiv)
- name: Setup Gradle Cache - name: Setup Gradle Cache
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
@ -65,23 +73,19 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
# Frontend Build (nur für web-app) # Frontend Build (Nur für web-app notwendig)
# Baut die statischen Dateien, die das Dockerfile dann per COPY reinzieht
- name: Build Frontend (Kotlin JS) - name: Build Frontend (Kotlin JS)
if: matrix.service == 'web-app' if: matrix.service == 'web-app'
run: | run: |
chmod +x gradlew chmod +x gradlew
./gradlew :frontend:shells:meldestelle-portal:jsBrowserDistribution -Pproduction=true --no-daemon ./gradlew :frontend:shells:meldestelle-portal:jsBrowserDistribution -Pproduction=true --no-daemon
# QEMU für Multi-Arch Support (ARM64 + AMD64) # OPTIMIERUNG: QEMU entfernt, da der Runner nativ auf ARM64 (Zora) läuft.
- name: Set up QEMU # Docker Buildx für effizienten Build-Support
uses: docker/setup-qemu-action@v3
# Docker Buildx für erweiterten Build-Support
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
# Login bei der Gitea Registry # Login bei deiner Gitea Registry
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@ -90,23 +94,24 @@ jobs:
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
# Metadaten extrahieren (Tags, Labels) # Metadaten extrahieren (Tags, Labels)
- name: Extract metadata (tags, labels) for Docker - name: Extract metadata
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-${{ matrix.image }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.image }}
tags: | tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=sha,format=long type=sha,format=long
# Build und Push # Build und Push (Nativ ARM64 für maximale Geschwindigkeit)
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: ${{ matrix.context }} context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }} file: ${{ matrix.dockerfile }}
push: true push: true
platforms: linux/amd64,linux/arm64 # Fokus auf ARM64 für Zora, AMD64 bleibt für Kompatibilität (optional)
platforms: linux/arm64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
build-args: | build-args: |
@ -114,5 +119,7 @@ jobs:
VERSION=${{ github.sha }} VERSION=${{ github.sha }}
GRADLE_VERSION=${{ env.GRADLE_VERSION }} GRADLE_VERSION=${{ env.GRADLE_VERSION }}
JAVA_VERSION=${{ env.JAVA_VERSION }} JAVA_VERSION=${{ env.JAVA_VERSION }}
KEYCLOAK_IMAGE_TAG=26.4
JVM_OPTS_APPEND=${{ env.JVM_OPTS_ARM64 }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max