Integrate billing-service microservice: add API gateway routing, service discovery with Consul, Docker support, and Spring configuration. Update frontend with API integration, BillingRepository, and BillingViewModel.
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
# ===================================================================
|
||||
# Dockerfile for Billing Service
|
||||
# Based on Spring Boot Service Template with Billing-specific configuration
|
||||
# ===================================================================
|
||||
|
||||
# === CENTRALIZED BUILD ARGUMENTS ===
|
||||
ARG GRADLE_VERSION
|
||||
ARG JAVA_VERSION
|
||||
ARG BUILD_DATE
|
||||
ARG VERSION
|
||||
|
||||
# Service-specific arguments
|
||||
ARG SERVICE_PATH=billing/billing-service
|
||||
ARG SERVICE_NAME=billing-service
|
||||
|
||||
# ===================================================================
|
||||
# Build Stage
|
||||
# ===================================================================
|
||||
FROM gradle:${GRADLE_VERSION}-jdk${JAVA_VERSION}-alpine AS builder
|
||||
|
||||
# Re-declare build arguments for this stage
|
||||
ARG SERVICE_PATH=billing/billing-service
|
||||
ARG SERVICE_NAME=billing-service
|
||||
|
||||
LABEL stage=builder
|
||||
LABEL maintainer="Meldestelle Development Team"
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
# Gradle optimizations
|
||||
ENV GRADLE_OPTS="-Dorg.gradle.caching=true \
|
||||
-Dorg.gradle.daemon=false \
|
||||
-Dorg.gradle.parallel=true \
|
||||
-Dorg.gradle.configureondemand=true \
|
||||
-Xmx2g"
|
||||
|
||||
# Copy build files in optimal order for caching
|
||||
COPY gradlew gradlew.bat gradle.properties settings.gradle.kts ./
|
||||
COPY gradle/ gradle/
|
||||
|
||||
# Make gradlew executable
|
||||
RUN chmod +x gradlew
|
||||
|
||||
COPY platform/ platform/
|
||||
COPY core/ core/
|
||||
COPY build.gradle.kts ./
|
||||
|
||||
# Copy billing service modules
|
||||
COPY backend/services/billing/billing-domain/ backend/services/billing/billing-domain/
|
||||
COPY backend/services/billing/billing-service/ backend/services/billing/billing-service/
|
||||
|
||||
# Build billing service
|
||||
RUN echo "Building Billing Service..." && \
|
||||
./gradlew :backend:services:billing:billing-service:dependencies --no-daemon --info && \
|
||||
./gradlew :backend:services:billing:billing-service:bootJar --no-daemon --info
|
||||
|
||||
# Extract JAR layers
|
||||
WORKDIR /builder
|
||||
RUN cp /workspace/backend/services/billing/billing-service/build/libs/*.jar app.jar && \
|
||||
java -Djarmode=layertools -jar app.jar extract
|
||||
|
||||
# ===================================================================
|
||||
# Runtime Stage
|
||||
# ===================================================================
|
||||
FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine AS runtime
|
||||
|
||||
# Metadata
|
||||
LABEL service="billing-service" \
|
||||
version="1.0.0" \
|
||||
description="Billing and Financial Service for Austrian Equestrian Federation" \
|
||||
maintainer="Meldestelle Development Team" \
|
||||
java.version="${JAVA_VERSION}"
|
||||
|
||||
# Build arguments
|
||||
ARG APP_USER=billinguser
|
||||
ARG APP_GROUP=billinggroup
|
||||
ARG APP_UID=1008
|
||||
ARG APP_GID=1008
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# System setup
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache curl jq tzdata && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
# 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=billing/billing-service
|
||||
ARG SERVICE_NAME=billing-service
|
||||
|
||||
# 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}
|
||||
|
||||
# Expose application port and debug port
|
||||
EXPOSE 8087 5012
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=15s --timeout=3s --start-period=40s --retries=3 \
|
||||
CMD curl -fsS --max-time 2 http://localhost:8087/actuator/health/readiness || exit 1
|
||||
|
||||
# JVM configuration
|
||||
ENV JAVA_OPTS="-XX:MaxRAMPercentage=80.0 \
|
||||
-XX:+UseG1GC \
|
||||
-XX:+UseStringDeduplication \
|
||||
-XX:+UseContainerSupport \
|
||||
-Djava.security.egd=file:/dev/./urandom \
|
||||
-Djava.awt.headless=true \
|
||||
-Dfile.encoding=UTF-8 \
|
||||
-Duser.timezone=Europe/Vienna"
|
||||
|
||||
# Spring Boot configuration
|
||||
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
|
||||
SERVER_PORT=8087 \
|
||||
LOGGING_LEVEL_ROOT=INFO \
|
||||
LOGGING_LEVEL_AT_MOCODE_BILLING=DEBUG
|
||||
|
||||
# Startup command
|
||||
ENTRYPOINT ["sh", "-c", "\
|
||||
echo 'Starting Billing Service on port 8087...'; \
|
||||
if [ \"${DEBUG:-false}\" = \"true\" ]; then \
|
||||
echo 'Debug mode enabled on port 5012'; \
|
||||
exec java $JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5012 org.springframework.boot.loader.launch.JarLauncher; \
|
||||
else \
|
||||
exec java $JAVA_OPTS org.springframework.boot.loader.launch.JarLauncher; \
|
||||
fi"]
|
||||
@@ -21,6 +21,10 @@ dependencies {
|
||||
implementation(libs.spring.boot.starter.validation)
|
||||
implementation(libs.spring.boot.starter.actuator)
|
||||
implementation(libs.jackson.module.kotlin)
|
||||
implementation(libs.spring.cloud.starter.consul.discovery)
|
||||
implementation(libs.micrometer.tracing.bridge.brave)
|
||||
implementation(libs.zipkin.reporter.brave)
|
||||
implementation(libs.zipkin.sender.okhttp3)
|
||||
|
||||
// Datenbank-Abhängigkeiten
|
||||
implementation(libs.exposed.core)
|
||||
|
||||
+2
@@ -4,8 +4,10 @@ package at.mocode.billing.service
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
class BillingServiceApplication
|
||||
|
||||
|
||||
Reference in New Issue
Block a user