diff --git a/Dockerfile b/Dockerfile index 377ca4d..2bc3434 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,19 @@ +FROM openjdk:17 AS builder +COPY gradlew . +COPY gradle gradle +COPY build.gradle . +COPY settings.gradle . +COPY src src +RUN chmod +x ./gradlew +RUN microdnf install findutils +RUN ./gradlew build -x test -FROM amazoncorretto:17-alpine-jdk - -WORKDIR /app - -COPY build/libs/*.jar app.jar - +# base-image +FROM openjdk:17 +# build file path +RUN mkdir /opt/app +# copy jar file to container +COPY --from=builder build/libs/*.jar /opt/app/spring-boot-application.jar EXPOSE 8080 - -ENTRYPOINT ["java", "-jar", "app.jar"] +# run jar file +ENTRYPOINT ["java","-jar","/opt/app/spring-boot-application.jar"] \ No newline at end of file