Remove outdated BillingController implementation, resolve conflicting bean definitions across modules, and retain the updated BillingController for consistency with frontend API logic.

This commit is contained in:
2026-04-12 21:51:33 +02:00
parent 9754f3e36b
commit 5eb2dd6904
28 changed files with 912 additions and 776 deletions
+63 -103
View File
@@ -1,34 +1,26 @@
# syntax=docker/dockerfile:1.7
# ===================================================================
# Dockerfile for Events Service
# Based on Spring Boot Service Template with Events-specific configuration
# Multi-stage Dockerfile for Meldestelle Events Service
# Features: Security hardening, monitoring support, optimal caching, BuildKit cache mounts
# Version: 2.6.0 - Reliable Monorepo Build
# ===================================================================
# === CENTRALIZED BUILD ARGUMENTS ===
# Values sourced from docker/versions.toml and docker/build-args/
# Global arguments (docker/build-args/global.env)
ARG GRADLE_VERSION
ARG JAVA_VERSION
ARG GRADLE_VERSION=9.4.1
ARG JAVA_VERSION=25
ARG BUILD_DATE
ARG VERSION
# Service-specific arguments (docker/build-args/services.env)
# Note: Keine Runtime-Profile/Ports als Build-ARGs
ARG SERVICE_PATH=events/events-service
ARG SERVICE_NAME=events-service
ARG VERSION=1.0.0-SNAPSHOT
# ===================================================================
# Build Stage
# ===================================================================
FROM gradle:${GRADLE_VERSION}-jdk${JAVA_VERSION}-alpine AS builder
FROM eclipse-temurin:${JAVA_VERSION}-jdk-alpine AS builder
# Re-declare build arguments for this stage (nur Build-Zeit)
ARG SERVICE_PATH=events/events-service
ARG SERVICE_NAME=events-service
ARG VERSION
ARG BUILD_DATE
LABEL stage=builder
LABEL maintainer="Meldestelle Development Team"
LABEL stage=builder \
service="events-service" \
maintainer="Meldestelle Development Team"
WORKDIR /workspace
@@ -36,35 +28,26 @@ WORKDIR /workspace
ENV GRADLE_OPTS="-Dorg.gradle.caching=true \
-Dorg.gradle.daemon=false \
-Dorg.gradle.parallel=true \
-Dorg.gradle.configureondemand=true \
-Xmx2g"
-Dorg.gradle.workers.max=2 \
-Dorg.gradle.jvmargs=-Xmx2g \
-XX:+UseParallelGC \
-XX:MaxMetaspaceSize=512m"
ENV GRADLE_USER_HOME=/root/.gradle
# Copy build files in optimal order for caching
COPY gradlew gradlew.bat gradle.properties settings.gradle.kts ./
COPY gradle/ gradle/
# 1. Copy full project structure for a reliable monorepo build
# .dockerignore should be used to exclude unnecessary files (IDE, logs, etc.)
COPY . .
# Make gradlew executable (required on Linux/Unix systems)
RUN chmod +x gradlew
COPY platform/ platform/
COPY core/ core/
COPY build.gradle.kts ./
# 2. Build the service
RUN --mount=type=cache,target=/root/.gradle/caches \
--mount=type=cache,target=/root/.gradle/wrapper \
./gradlew :backend:services:events:events-service:bootJar --no-daemon --info
# Copy events service modules in dependency order
COPY events/events-domain/ events/events-domain/
COPY events/events-api/ events/events-api/
COPY events/events-application/ events/events-application/
COPY events/events-infrastructure/ events/events-infrastructure/
COPY events/events-service/ events/events-service/
# Build events service (ohne Runtime-Profile bei Build)
RUN echo "Building Events Service..." && \
./gradlew :events:events-service:dependencies --no-daemon --info && \
./gradlew :events:events-service:bootJar --no-daemon --info
# Extract JAR layers for optimized Docker layer caching
# 3. Extract layers
WORKDIR /builder
RUN cp /workspace/events/events-service/build/libs/*.jar app.jar && \
RUN cp /workspace/backend/services/events/events-service/build/libs/*.jar app.jar && \
java -Djarmode=layertools -jar app.jar extract
# ===================================================================
@@ -72,40 +55,34 @@ RUN cp /workspace/events/events-service/build/libs/*.jar app.jar && \
# ===================================================================
FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine AS runtime
# Metadata
LABEL service="events-service" \
version="1.0.0" \
description="Events Management Service for Austrian Equestrian Federation" \
maintainer="Meldestelle Development Team" \
java.version="${JAVA_VERSION}"
ARG BUILD_DATE
ARG VERSION
ARG JAVA_VERSION
# Build arguments
ARG APP_USER=eventsuser
ARG APP_GROUP=eventsgroup
ARG APP_UID=1006
ARG APP_GID=1006
LABEL service="events-service" \
version="${VERSION}" \
description="Microservice for Events and Tournaments" \
maintainer="Meldestelle Development Team" \
java.version="${JAVA_VERSION}" \
build.date="${BUILD_DATE}"
ARG APP_USER=appuser
ARG APP_GROUP=appgroup
ARG APP_UID=1001
ARG APP_GID=1001
WORKDIR /app
# System setup
RUN apk update && \
apk upgrade && \
apk add --no-cache curl jq tzdata && \
rm -rf /var/cache/apk/*
apk add --no-cache curl tzdata tini && \
rm -rf /var/cache/apk/* && addgroup -g ${APP_GID} -S ${APP_GROUP} && \
adduser -u ${APP_UID} -S ${APP_USER} -G ${APP_GROUP} -h /app -s /bin/sh && \
mkdir -p /app/logs /app/tmp /app/config && \
chown -R ${APP_USER}:${APP_GROUP} /app && \
chmod -R 750 /app
# Non-root user creation
RUN addgroup -g ${APP_GID} -S ${APP_GROUP} && \
adduser -u ${APP_UID} -S ${APP_USER} -G ${APP_GROUP} -h /app -s /bin/sh
# Directory setup
RUN mkdir -p /app/logs /app/tmp && \
chown -R ${APP_USER}:${APP_GROUP} /app
# Re-declare build arguments for runtime stage
ARG SERVICE_PATH=events/events-service
ARG SERVICE_NAME=events-service
# Copy Spring Boot layers in optimal order for Docker layer caching
# Copy Spring Boot layers
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /builder/dependencies/ ./
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /builder/spring-boot-loader/ ./
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /builder/snapshot-dependencies/ ./
@@ -113,55 +90,38 @@ COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /builder/application/ ./
USER ${APP_USER}
# Expose application port and debug port
EXPOSE 8085 5006
EXPOSE 8085 5005
# Health check
HEALTHCHECK --interval=15s --timeout=3s --start-period=40s --retries=3 \
CMD curl -fsS --max-time 2 http://localhost:8085/actuator/health/readiness || exit 1
# JVM configuration optimized for events service
ENV JAVA_OPTS="-XX:MaxRAMPercentage=80.0 \
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75.0 \
-XX:+UseG1GC \
-XX:+UseStringDeduplication \
-XX:+UseContainerSupport \
-XX:G1HeapRegionSize=16m \
-XX:+OptimizeStringConcat \
-XX:+UseCompressedOops \
-XX:G1ReservePercent=25 \
-XX:InitiatingHeapOccupancyPercent=30 \
-XX:+AlwaysPreTouch \
-XX:+DisableExplicitGC \
-Djava.security.egd=file:/dev/./urandom \
-Djava.awt.headless=true \
-Dfile.encoding=UTF-8 \
-Duser.timezone=Europe/Vienna \
-Dmanagement.endpoints.web.exposure.include=health,info,metrics,prometheus"
-Dspring.backgroundpreinitializer.ignore=true \
-Dmanagement.endpoints.web.exposure.include=health,info,metrics,prometheus \
-Dmanagement.endpoint.health.show-details=always \
-Dmanagement.prometheus.metrics.export.enabled=true"
# Spring Boot configuration (Profile nur zur Laufzeit via Compose/Env)
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
SERVER_PORT=8085 \
LOGGING_LEVEL_ROOT=INFO \
LOGGING_LEVEL_AT_MOCODE_EVENTS=DEBUG
LOGGING_LEVEL_ROOT=INFO
# Startup command with debug support
ENTRYPOINT ["sh", "-c", "\
echo 'Starting Events Service on port 8085...'; \
ENTRYPOINT ["tini", "--", "sh", "-c", "\
echo 'Starting Events Service with Java ${JAVA_VERSION}...'; \
if [ \"${DEBUG:-false}\" = \"true\" ]; then \
echo 'Debug mode enabled on port 5006'; \
exec java $JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5006 org.springframework.boot.loader.launch.JarLauncher; \
echo 'DEBUG mode enabled'; \
exec java ${JAVA_OPTS} -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 org.springframework.boot.loader.launch.JarLauncher; \
else \
exec java $JAVA_OPTS org.springframework.boot.loader.launch.JarLauncher; \
exec java ${JAVA_OPTS} org.springframework.boot.loader.launch.JarLauncher; \
fi"]
# ===================================================================
# Documentation
# ===================================================================
# Build commands:
# docker build -t meldestelle/events-service:latest -f dockerfiles/services/events-service/Dockerfile .
# docker run -p 8086:8086 --name events-service meldestelle/events-service:latest
#
# Key features:
# - Multi-stage build with JAR layer extraction for optimal caching
# - Non-root user execution for security (UID/GID 1006)
# - Optimized JVM settings for containers
# - Comprehensive health checks with events-specific endpoint
# - Debug support on port 5006
# - Vienna timezone configuration for Austrian operations
# ===================================================================