diff --git a/dockerfile b/dockerfile index 6fad8f9..48ce5db 100644 --- a/dockerfile +++ b/dockerfile @@ -1,7 +1,23 @@ -FROM eclipse-temurin:17-jdk +# Stage 1: Build the JAR +FROM eclipse-temurin:17-jdk AS build -COPY ./target/*.jar app.jar +WORKDIR /app + +# Copy Maven files and source code +COPY pom.xml . +COPY src ./src + +# Build the Spring Boot app +RUN ./mvnw clean package -DskipTests + +# Stage 2: Runtime +FROM eclipse-temurin:17-jdk-slim + +WORKDIR /app + +# Copy built JAR from build stage +COPY --from=build /app/target/*.jar app.jar EXPOSE 8080 -ENTRYPOINT ["java","-jar", "app.jar"] \ No newline at end of file +ENTRYPOINT ["java","-jar","app.jar"]