-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d0f6f5
commit 077d128
Showing
2 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
# 비교를 위한 Dockerfilek 사용 안함 | ||
FROM openjdk:11-jre-slim as builder | ||
EXPOSE 8088 | ||
ARG JAR_FILE=target/*.jar | ||
WORKDIR application | ||
COPY ${JAR_FILE} application.jar | ||
# 멀티 스테이지 빌드 방법 사용 | ||
# 첫번쨰 스테이지 | ||
FROM openjdk:11 as stage1 | ||
WORKDIR /app | ||
|
||
# /app/gradlew 파일로 생성 | ||
COPY gradlew . | ||
# /app/gradle 디렉토리로 생성 | ||
COPY gradle gradle | ||
# /app/src 디렉토리로 생성 | ||
COPY src src | ||
# /app/gradlew 파일로 생성 | ||
COPY build.gradle . | ||
# gradlew 파일을 실행 가능하게 변경 | ||
COPY settings.gradle . | ||
|
||
RUN ./gradlew bootJar | ||
|
||
# 두번째 스테이지 | ||
FROM openjdk:11 as stage2 | ||
WORKDIR /app | ||
# stage1에서 생성된 jar 파일을 stage2에 app.jar라는 이름으로 복사 | ||
COPY --from=stage1 /app/build/libs/*.jar app.jar | ||
|
||
# CMD 또는 ENTRYPOINT를 사용하여 실행할 명령어를 지정 | ||
ENTRYPOINT ["java", "-jar", "app.jar"] |