# --- Builder Stage ---
FROM maven:3.9.11-eclipse-temurin-25 AS builder
WORKDIR /app

COPY pom.xml .
RUN mvn dependency:go-offline -B

COPY src ./src
RUN mvn clean package -DskipTests

# --- Runtime Stage ---
# Changed from alpine to the standard 'jre' image (Ubuntu-based)
# This provides the glibc environment SevenZipJBinding needs.
FROM eclipse-temurin:25-jre-jammy
WORKDIR /app

# Copy the jar from the builder stage
COPY --from=builder /app/target/*.jar app.jar

EXPOSE 8080

# Added --enable-native-access=ALL-UNNAMED for Java 25 compatibility with JNI
ENTRYPOINT ["java", "--enable-native-access=ALL-UNNAMED", "-jar", "/app/app.jar"]