meldestelle/.gitea/workflows/docker-publish.yaml
StefanMoCoAt 12d30fc698
Some checks failed
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
Optimize pipeline: split jobs and reduce workers
2026-03-03 21:32:44 +01:00

127 lines
3.8 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'
JVM_OPTS_ARM64: "-XX:ActiveProcessorCount=12 -XX:+UseG1GC -XX:+UseTransparentHugePages -XX:+UseSVE=1"
jobs:
# JOB 1: Infrastruktur & Backend (Ohne JS-Build)
build-backend:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- service: 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 ${{ 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-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
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') }}
- name: Build Frontend (Kotlin JS)
run: |
chmod +x gradlew
./gradlew :frontend:shells:meldestelle-portal:jsBrowserDistribution \
-Pproduction=true \
--max-workers=4 \
-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