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
+34 -89
View File
@@ -1,15 +1,14 @@
# ===================================================================
# Multi-stage Dockerfile for Meldestelle API Gateway
# Features: Security hardening, monitoring support, optimal caching, BuildKit cache mounts
# Version: 2.2.2 - Optimized for Monorepo (Fixed frontend paths after refactoring)
# Version: 2.6.0 - Reliable Monorepo Build
# ===================================================================
# === CENTRALIZED BUILD ARGUMENTS ===
# HINWEIS: gradle:X.Y-jdkZ-alpine Images existieren nicht für alle Gradle/JDK-Kombinationen.
# Wir verwenden eclipse-temurin als Builder-Basis und das Projekt-eigene ./gradlew-Wrapper.
ARG JAVA_VERSION=21
ARG GRADLE_VERSION=9.4.1
ARG JAVA_VERSION=25
ARG BUILD_DATE
ARG VERSION
ARG VERSION=1.0.0-SNAPSHOT
# ===================================================================
# Build Stage
@@ -19,9 +18,9 @@ FROM eclipse-temurin:${JAVA_VERSION}-jdk-alpine AS builder
ARG VERSION
ARG BUILD_DATE
LABEL stage=builder
LABEL service="api-gateway"
LABEL maintainer="Meldestelle Development Team"
LABEL stage=builder \
service="api-gateway" \
maintainer="Meldestelle Development Team"
WORKDIR /workspace
@@ -35,62 +34,21 @@ ENV GRADLE_OPTS="-Dorg.gradle.caching=true \
-XX:MaxMetaspaceSize=512m"
ENV GRADLE_USER_HOME=/root/.gradle
# Copy gradle wrapper and configuration files
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 . .
RUN chmod +x gradlew
# Copy platform and core dependencies
COPY platform/ platform/
COPY core/ core/
# 2. Build the service
RUN --mount=type=cache,target=/root/.gradle/caches \
--mount=type=cache,target=/root/.gradle/wrapper \
./gradlew :backend:infrastructure:gateway:bootJar --no-daemon --info
# Copy backend directories
COPY backend/infrastructure/ backend/infrastructure/
COPY backend/services/ backend/services/
COPY contracts/ contracts/
# Create dummy frontend directories to satisfy settings.gradle.kts include paths
# This prevents Gradle from failing configuration phase without copying actual frontend code
RUN mkdir -p \
frontend/core/auth \
frontend/core/domain \
frontend/core/design-system \
frontend/core/navigation \
frontend/core/network \
frontend/core/local-db \
frontend/core/sync \
frontend/shared \
frontend/shells/meldestelle-portal \
frontend/shells/meldestelle-desktop \
frontend/features/ping-feature \
frontend/features/nennung-feature \
frontend/features/zns-import-feature \
frontend/features/billing-feature \
frontend/features/pferde-feature \
frontend/features/verein-feature \
frontend/features/veranstaltung-feature \
frontend/features/veranstalter-feature \
frontend/features/profile-feature \
frontend/features/reiter-feature \
frontend/features/turnier-feature \
docs
# Copy root build configuration
COPY build.gradle.kts ./
# Download and cache dependencies
RUN --mount=type=cache,id=gradle-cache-gateway,target=/root/.gradle/caches \
--mount=type=cache,id=gradle-wrapper-gateway,target=/root/.gradle/wrapper \
./gradlew :backend:infrastructure:gateway:dependencies --info
# Build the application
RUN --mount=type=cache,id=gradle-cache-gateway,target=/root/.gradle/caches \
--mount=type=cache,id=gradle-wrapper-gateway,target=/root/.gradle/wrapper \
./gradlew :backend:infrastructure:gateway:bootJar --info
# Extract JAR layers
RUN mkdir -p build/dependency && \
(cd build/dependency; java -Djarmode=layertools -jar /workspace/backend/infrastructure/gateway/build/libs/*.jar extract)
# 3. Extract layers
WORKDIR /builder
RUN cp /workspace/backend/infrastructure/gateway/build/libs/*.jar app.jar && \
java -Djarmode=layertools -jar app.jar extract
# ===================================================================
# Runtime Stage
@@ -101,19 +59,15 @@ ARG BUILD_DATE
ARG VERSION
ARG JAVA_VERSION
ENV JAVA_VERSION=${JAVA_VERSION} \
VERSION=${VERSION} \
BUILD_DATE=${BUILD_DATE}
LABEL service="api-gateway" \
version="${VERSION}" \
description="Spring Cloud Gateway for Meldestelle microservices architecture" \
description="Microservice for API Gateway and Routing" \
maintainer="Meldestelle Development Team" \
org.opencontainers.image.title="Meldestelle API Gateway" \
org.opencontainers.image.created="${BUILD_DATE}"
java.version="${JAVA_VERSION}" \
build.date="${BUILD_DATE}"
ARG APP_USER=gateway
ARG APP_GROUP=gateway
ARG APP_USER=appuser
ARG APP_GROUP=appgroup
ARG APP_UID=1001
ARG APP_GID=1001
@@ -121,21 +75,18 @@ WORKDIR /app
RUN apk update && \
apk upgrade && \
apk add --no-cache \
curl \
tzdata \
tini && \
rm -rf /var/cache/apk/* && \
addgroup -g ${APP_GID} -S ${APP_GROUP} && \
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
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /workspace/build/dependency/dependencies/ ./
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /workspace/build/dependency/spring-boot-loader/ ./
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /workspace/build/dependency/snapshot-dependencies/ ./
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /workspace/build/dependency/application/ ./
# 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/ ./
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /builder/application/ ./
USER ${APP_USER}
@@ -144,7 +95,7 @@ EXPOSE 8081 5005
HEALTHCHECK --interval=15s --timeout=3s --start-period=40s --retries=3 \
CMD curl -fsS --max-time 2 http://localhost:8081/actuator/health/readiness || exit 1
ENV JAVA_OPTS="-XX:MaxRAMPercentage=80.0 \
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75.0 \
-XX:+UseG1GC \
-XX:+UseStringDeduplication \
-XX:+UseContainerSupport \
@@ -158,25 +109,19 @@ ENV JAVA_OPTS="-XX:MaxRAMPercentage=80.0 \
-Dfile.encoding=UTF-8 \
-Duser.timezone=Europe/Vienna \
-Dspring.backgroundpreinitializer.ignore=true \
-Dmanagement.endpoints.web.exposure.include=health,info,metrics,prometheus,gateway \
-Dmanagement.endpoints.web.exposure.include=health,info,metrics,prometheus \
-Dmanagement.endpoint.health.show-details=always \
-Dmanagement.prometheus.metrics.export.enabled=true"
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
SERVER_PORT=8081 \
LOGGING_LEVEL_ROOT=INFO \
LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_CLOUD_GATEWAY=DEBUG
LOGGING_LEVEL_ROOT=INFO
ENTRYPOINT ["tini", "--", "sh", "-c", "\
echo 'Starting API Gateway with Java ${JAVA_VERSION}...'; \
echo 'Active Spring profiles: '${SPRING_PROFILES_ACTIVE:-not-set}; \
echo 'Gateway port: ${SERVER_PORT}'; \
MEMORY_LIMIT=$(cat /sys/fs/cgroup/memory.max 2>/dev/null || cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>/dev/null || echo 'unlimited'); \
echo \"Container memory limit: $MEMORY_LIMIT\"; \
if [ \"${DEBUG:-false}\" = \"true\" ]; then \
echo 'DEBUG mode enabled - remote debugging available on port 5005'; \
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 \
echo 'Starting API Gateway in production mode'; \
exec java ${JAVA_OPTS} org.springframework.boot.loader.launch.JarLauncher; \
fi"]