FROM maven:3.8-eclipse-temurin-21-alpine AS build

WORKDIR /app

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

COPY src ./src

RUN mvn clean package -DskipTests

FROM eclipse-temurin:21-jdk-alpine

COPY --from=build /app/target/*.jar /app.jar

CMD ["java", "-jar", "app.jar"]