name: Build and Publish Docker Images on: push: branches: [ "main" ] paths: - 'backend/**' - 'core/**' - 'frontend/**' - 'config/docker/**' - 'docker-compose.yaml' - '.gitea/workflows/docker-publish.yaml' jobs: # JOB 1: Backend & Infrastructure (Sequenziell durch max-parallel: 1) build-backend: runs-on: ubuntu-latest strategy: fail-fast: true max-parallel: 1 # WICHTIG: Verhindert den gleichzeitigen GitHub-Zugriff & RAM-Overload matrix: include: - service: api-gateway dockerfile: backend/infrastructure/gateway/Dockerfile - service: ping-service dockerfile: backend/services/ping/Dockerfile - service: keycloak dockerfile: config/docker/keycloak/Dockerfile steps: - name: Checkout uses: actions/checkout@v4 - name: Java Setup uses: actions/setup-java@v4 with: java-version: '25' distribution: 'temurin' - name: Buildx Setup uses: actions/setup-buildx-action@v3 - name: Registry Login uses: docker/login-action@v3 with: registry: git.mo-code.at username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_TOKEN }} - name: Docker Build and Push uses: docker/build-push-action@v5 with: context: . file: ${{ matrix.dockerfile }} push: true # Hardcoded Pfad zur Vermeidung von Auflösungsfehlern tags: git.mo-code.at/mocode-software/meldestelle/${{ matrix.service }}:latest build-args: | GRADLE_VERSION=9.3.1 JAVA_VERSION=25 JVM_OPTS_APPEND=-XX:ActiveProcessorCount=8 -XX:+UseG1GC -XX:+UseSVE=1 # JOB 2: Frontend (Startet erst, wenn Backend-Jobs fertig sind) build-frontend: needs: build-backend runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Java Setup uses: actions/setup-java@v4 with: java-version: '25' distribution: 'temurin' - name: Compile Kotlin JS run: | chmod +x gradlew ./gradlew :frontend:shells:meldestelle-portal:jsBrowserDistribution \ -Pproduction=true \ --max-workers=4 \ --no-daemon \ -Dkotlin.daemon.jvm.options="-Xmx4g" - name: Buildx Setup uses: actions/setup-buildx-action@v3 - name: Registry Login uses: docker/login-action@v3 with: registry: git.mo-code.at username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_TOKEN }} - name: Docker Build and Push Web-App uses: docker/build-push-action@v5 with: context: . file: config/docker/caddy/web-app/Dockerfile push: true tags: git.mo-code.at/mocode-software/meldestelle/web-app:latest