Some checks failed
Build and Publish Docker Images / build-backend (backend/infrastructure/gateway/Dockerfile, api-gateway) (push) Failing after 8s
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 6s
Build and Publish Docker Images / build-frontend (push) Failing after 4s
123 lines
3.7 KiB
YAML
123 lines
3.7 KiB
YAML
name: Build and Publish Docker Images
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
paths:
|
|
- 'backend/**'
|
|
- 'platform/**'
|
|
- 'core/**'
|
|
- 'frontend/**'
|
|
- 'config/docker/**'
|
|
- 'build.gradle.kts'
|
|
- 'settings.gradle.kts'
|
|
- 'gradle.properties'
|
|
- 'docker-compose.yaml'
|
|
- '.gitea/workflows/docker-publish.yaml'
|
|
|
|
env:
|
|
REGISTRY: git.mo-code.at
|
|
IMAGE_PREFIX: mocode-software/meldestelle
|
|
JAVA_VERSION: '25'
|
|
GRADLE_VERSION: '9.3.1'
|
|
# Optimierte JVM Flags für den ARM-Runner
|
|
JVM_OPTS_ARM64: "-XX:ActiveProcessorCount=8 -XX:+UseG1GC -XX:+UseTransparentHugePages -XX:+UseSVE=1"
|
|
|
|
jobs:
|
|
# JOB 1: Backend Services & Keycloak
|
|
build-backend:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
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 repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK
|
|
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-backend-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
|
|
|
- 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
|
|
# Hier war der Fehler: Jetzt korrekt auf env.REGISTRY
|
|
tags: ${{ env.REGISTRY }}/${{ 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: Das speicherintensive Frontend (Web-App)
|
|
build-frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
distribution: 'temurin'
|
|
|
|
- name: Build Frontend (Kotlin JS)
|
|
run: |
|
|
chmod +x gradlew
|
|
# Reduzierte Worker, um den RAM (10GB) nicht zu sprengen
|
|
./gradlew :frontend:shells:meldestelle-portal:jsBrowserDistribution \
|
|
-Pproduction=true \
|
|
--max-workers=4 \
|
|
--no-daemon \
|
|
-Dkotlin.daemon.jvm.options="-Xmx4g"
|
|
|
|
- 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 Web-App Image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: config/docker/caddy/web-app/Dockerfile
|
|
push: true
|
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/web-app:latest
|