fixing(client)

This commit is contained in:
2025-08-13 00:07:08 +02:00
parent 23b6708197
commit 26e826d32c
23 changed files with 3650 additions and 1077 deletions
+33 -9
View File
@@ -1,17 +1,41 @@
FROM openjdk:17-jre-slim
# syntax=docker/dockerfile:1
# Build stage: compile the ping-service JAR inside Docker
FROM gradle:8.7-jdk17-alpine AS builder
WORKDIR /workspace
# Copy the entire repository (simplest and most robust for multi-module setups)
# This allows building the ping-service even if it depends on shared build files or platforms.
COPY . .
# Build only the ping-service artifact
RUN gradle :temp:ping-service:bootJar --no-daemon
# Runtime stage: slim JRE image to run the service
FROM eclipse-temurin:17-jre-alpine
# Set working directory
WORKDIR /app
# Copy the ping-service JAR file
COPY temp/ping-service/build/libs/*.jar app.jar
# Install curl for health checks (small footprint on Alpine)
RUN apk add --no-cache curl
# Expose port (will be assigned dynamically by Spring Boot)
EXPOSE 8080
# Create a non-root user for better security
RUN addgroup -S app && adduser -S app -G app
USER app
# Add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=20s --retries=3 \
CMD curl -f http://localhost:8080/ping || exit 1
# Copy the built JAR from the builder stage
COPY --from=builder /workspace/temp/ping-service/build/libs/*.jar app.jar
# Expose application port
EXPOSE 8082
# Health check against the ping endpoint
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl -fsS http://localhost:8082/ping || exit 1
# JVM options can be overridden at runtime via JAVA_OPTS env
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -XX:+UseStringDeduplication"
# Run the application
ENTRYPOINT ["java", "-jar", "app.jar"]
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar app.jar"]