-
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
0e7cc8b
commit 041e735
Showing
1 changed file
with
20 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
# =============================== Start of Build Stage =============================== # | ||
FROM gradle:7.5.1-jdk17 AS build | ||
|
||
# 소스 코드 복사 | ||
# 작업 디렉토리 설정 | ||
WORKDIR /app | ||
|
||
# Gradle 캐시를 활용하기 위해 Gradle 설정 파일만 먼저 복사 | ||
COPY build.gradle settings.gradle /app/ | ||
|
||
# 종속성을 먼저 다운로드 | ||
RUN gradle build --no-daemon || return 0 | ||
|
||
# 전체 소스 코드 복사 | ||
COPY . /app | ||
|
||
# Gradle 빌드 수행 | ||
RUN ./gradlew clean build --no-daemon | ||
|
||
# =============================== Start of Runtime Stage =============================== # | ||
FROM openjdk:17-jdk-slim | ||
|
||
# 작업 디렉토리 설정 | ||
WORKDIR /app | ||
|
||
# Gradle 빌드 수행 | ||
# chmod +x ./gradlew | ||
RUN chmod +x ./gradlew | ||
RUN ./gradlew clean build --no-daemon --info > build.log 2>&1 || (cat build.log && exit 1) | ||
# 빌드 스테이지에서 생성된 JAR 파일 복사 | ||
COPY --from=build /app/build/libs/healthyLife-0.0.1-SNAPSHOT.jar /app/healthyLife-0.0.1-SNAPSHOT.jar | ||
|
||
# 애플리케이션 실행 | ||
CMD ["java", "-jar", "build/libs/healthyLife-0.0.1-SNAPSHOT.jar"] | ||
|
||
CMD ["java", "-jar", "healthyLife-0.0.1-SNAPSHOT.jar"] |