Optimize pipeline: split jobs and reduce workers
Build and Publish Docker Images / build-backend (backend/infrastructure/gateway/Dockerfile, gateway) (push) Failing after 1m10s
Build and Publish Docker Images / build-backend (backend/services/ping/Dockerfile, ping-service) (push) Failing after 6s
Build and Publish Docker Images / build-backend (config/docker/keycloak/Dockerfile, keycloak) (push) Failing after 7s
Build and Publish Docker Images / build-frontend (push) Failing after 6s

This commit is contained in:
2026-03-03 21:32:44 +01:00
parent e31edb1c6d
commit 12d30fc698
+62 -74
View File
@@ -1,5 +1,4 @@
name: Build and Publish Docker Images name: Build and Publish Docker Images
run-name: Build & Publish by @${{ github.actor }}
on: on:
push: push:
@@ -18,70 +17,89 @@ on:
env: env:
REGISTRY: git.mo-code.at REGISTRY: git.mo-code.at
# WICHTIG: Kleingeschrieben für Docker-Konformität
IMAGE_PREFIX: mocode-software/meldestelle IMAGE_PREFIX: mocode-software/meldestelle
# Build Arguments für Zora (ARM64 Power) JAVA_VERSION: '25'
JAVA_VERSION: "25" GRADLE_VERSION: '9.3.1'
GRADLE_VERSION: "9.3.1"
# OPTIMIERUNG: Gradle Parameter für mehr Speed
GRADLE_OPTS: "-Dorg.gradle.parallel=true -Dorg.gradle.workers.max=8"
# Deine neuen JVM Power-Flags für ARM64 (Cortex-A720)
JVM_OPTS_ARM64: "-XX:ActiveProcessorCount=12 -XX:+UseG1GC -XX:+UseTransparentHugePages -XX:+UseSVE=1" JVM_OPTS_ARM64: "-XX:ActiveProcessorCount=12 -XX:+UseG1GC -XX:+UseTransparentHugePages -XX:+UseSVE=1"
jobs: jobs:
build-and-push: # JOB 1: Infrastruktur & Backend (Ohne JS-Build)
build-backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
# NEU: Keycloak wird jetzt auch automatisch gebaut und gepusht - service: gateway
- service: keycloak
context: .
dockerfile: config/docker/keycloak/Dockerfile
image: keycloak
- service: api-gateway
context: .
dockerfile: backend/infrastructure/gateway/Dockerfile dockerfile: backend/infrastructure/gateway/Dockerfile
image: gateway
- service: ping-service - service: ping-service
context: .
dockerfile: backend/services/ping/Dockerfile dockerfile: backend/services/ping/Dockerfile
image: ping-service - service: keycloak
dockerfile: config/docker/keycloak/Dockerfile
- service: web-app
context: .
dockerfile: config/docker/caddy/web-app/Dockerfile
image: web-app
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
# Java Setup (Wichtig für Gradle-Builds im Runner) - name: Set up JDK ${{ env.JAVA_VERSION }}
- name: Set up JDK 25
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
java-version: '25' java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin' distribution: 'temurin'
cache: gradle
# Cache für Gradle (Beschleunigt Folgebauvorgänge massiv)
- name: Setup Gradle Cache - name: Setup Gradle Cache
uses: actions/cache@v3 uses: actions/cache@v4
with: with:
path: | path: |
~/.gradle/caches ~/.gradle/caches
~/.gradle/wrapper ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} key: ${{ runner.os }}-gradle-backend-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle- - name: Set up Docker Buildx
uses: actions/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push Backend Image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ env.REGISTRYRequested }}/${{ env.IMAGE_PREFIX }}/${{ matrix.service }}:latest
build-args: |
GRADLE_VERSION=${{ env.GRADLE_VERSION }}
JAVA_VERSION=${{ env.JAVA_VERSION }}
JVM_OPTS_APPEND=${{ env.JVM_OPTS_ARM64 }}
DOCKER_BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
# JOB 2: Frontend (Mit speicherintensivem Kotlin/JS Build)
build-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
- name: Setup Gradle Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-frontend-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# Frontend Build (Nur für web-app notwendig)
- name: Build Frontend (Kotlin JS) - name: Build Frontend (Kotlin JS)
if: matrix.service == 'web-app'
run: | run: |
chmod +x gradlew chmod +x gradlew
./gradlew :frontend:shells:meldestelle-portal:jsBrowserDistribution \ ./gradlew :frontend:shells:meldestelle-portal:jsBrowserDistribution \
@@ -90,13 +108,8 @@ jobs:
-Dkotlin.daemon.jvm.options="-Xmx4g" -Dkotlin.daemon.jvm.options="-Xmx4g"
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: actions/setup-buildx-action@v3
# with:
# # Wir erzwingen die Nutzung des Host-Drivers,
# # um gRPC-Abstürze im Container-Builder zu vermeiden
# driver: docker
# 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:
@@ -104,35 +117,10 @@ jobs:
username: ${{ secrets.REGISTRY_USER }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
# Metadaten extrahieren (Tags, Labels) - name: Build and push Web-App Image
- name: Extract metadata uses: docker/build-push-action@v5
id: meta
uses: docker/metadata-action@v5
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.image }} context: .
tags: | file: config/docker/caddy/web-app/Dockerfile
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=sha,format=long
# Build und Push (Nativ ARM64 für maximale Geschwindigkeit)
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: true push: true
# Fokus auf ARM64 für Zora, AMD64 bleibt für Kompatibilität (optional) tags: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/web-app:latest
platforms: linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
DOCKER_BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
VERSION=${{ github.sha }}
GRADLE_VERSION=${{ env.GRADLE_VERSION }}
JAVA_VERSION=${{ env.JAVA_VERSION }}
KEYCLOAK_IMAGE_TAG=26.4
JVM_OPTS_APPEND=${{ env.JVM_OPTS_ARM64 }}
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# cache-from: type=gha
# cache-to: type=gha,mode=max