From 94ae98277b6874edde2eb3e774c2a814b768a04d Mon Sep 17 00:00:00 2001 From: masiljangajji Date: Thu, 24 Oct 2024 09:38:17 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Dockerfile=20=EB=B3=80=EA=B2=BD=20(?= =?UTF-8?q?=EB=B9=8C=EB=93=9C=EA=B3=BC=EC=A0=95=20=ED=8F=AC=ED=95=A8?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) 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