auth / Dockerfile
learnifymedhub's picture
Update Dockerfile
e5486e1 verified
# /* File Path: /Dockerfile */
# Stage 1: Build stage
# Using '3-eclipse-temurin-25' ensures we get the latest Maven 3 with Java 25
FROM maven:3-eclipse-temurin-25 AS build
WORKDIR /app
# Cache dependencies
COPY pom.xml .
RUN mvn dependency:go-offline -B
# Build the app
COPY src src
RUN mvn clean package -DskipTests
# Stage 2: Runtime stage
# We use the '25-jre-alpine' for the smallest, most secure production footprint
FROM eclipse-temurin:25-jre-alpine
WORKDIR /app
# Copy the built jar from the build stage
COPY --from=build /app/target/*.jar app.jar
# Hugging Face specific setup
EXPOSE 7860
USER 1000
# Performance: Enable Virtual Threads for high concurrency on your 2 vCPUs
# Performance: Use MaxRAMPercentage to let the JVM manage the 16GB RAM dynamically
# Updated Entrypoint for 16GB RAM / 2 vCPU
ENTRYPOINT ["java", \
"-XX:+UseG1GC", \
"-XX:MaxGCPauseMillis=200", \
"-XX:ParallelGCThreads=2", \
"-XX:ConcGCThreads=1", \
"-XX:InitiatingHeapOccupancyPercent=45", \
"-XX:MaxRAMPercentage=75.0", \
"-Dspring.threads.virtual.enabled=true", \
"-jar", "app.jar", \
"--server.port=7860"]