FROM gradle:jdk23 AS builder
WORKDIR /app

COPY gradlew build.gradle.kts settings.gradle.kts config ./
COPY gradle gradle

RUN chmod +x gradlew
RUN gradle dependencies

COPY src src

RUN gradle clean build -x test -x checkstyleMain -x checkstyleTest -x compileTestJava

FROM openjdk:23-jdk-slim AS runtime
WORKDIR /app

COPY --from=builder /app/build/libs/*.jar app.jar

EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
