Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
seung-jun2 authored Jul 9, 2024
1 parent 0e7cc8b commit 041e735
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions Dockerfile
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"]

0 comments on commit 041e735

Please sign in to comment.