-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Dockerfile의 Gradle 빌드 파일 확장자 .kts로 수정 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1565e32
e4f6797
23b7b96
c18f95a
2524890
c477cf5
5feb7ac
392dd98
8d37c3c
bd7d8a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,17 +4,21 @@ ARG MODULE=apis | |||||||||||||||||||||||||||||||||||
| WORKDIR /app | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # 의존성 캐싱 최적화를 위한 단계별 복사 | ||||||||||||||||||||||||||||||||||||
| # 1. 의존성 관련 파일만 먼저 복사 | ||||||||||||||||||||||||||||||||||||
| COPY build.gradle settings.gradle ./ | ||||||||||||||||||||||||||||||||||||
| COPY ${MODULE}/build.gradle ./${MODULE}/ | ||||||||||||||||||||||||||||||||||||
| # 1. Gradle Wrapper와 의존성 관련 파일만 먼저 복사 | ||||||||||||||||||||||||||||||||||||
| COPY build.gradle.kts settings.gradle.kts gradlew gradlew.bat ./ | ||||||||||||||||||||||||||||||||||||
| COPY gradle/wrapper/ ./gradle/wrapper/ | ||||||||||||||||||||||||||||||||||||
| COPY ${MODULE}/build.gradle.kts ./${MODULE}/ | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # 2. 소스코드 없이 의존성만 다운로드 | ||||||||||||||||||||||||||||||||||||
| # 2. Gradle Wrapper 실행 권한 부여 | ||||||||||||||||||||||||||||||||||||
| RUN chmod +x gradlew | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) RUN 레이어 병합 고려
-RUN chmod +x gradlew
-
-# 3. 소스코드 없이 의존성만 다운로드
-RUN ./gradlew :${MODULE}:dependencies --no-daemon
+# 2-3. Wrapper 실행권한 부여 후 의존성만 다운로드
+RUN chmod +x gradlew \
+ && ./gradlew :${MODULE}:dependencies --no-daemon캐시 히트율은 동일하니 용량 절감이 필요하다면 고려해 보세요. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| # 3. 소스코드 없이 의존성만 다운로드 | ||||||||||||||||||||||||||||||||||||
| RUN ./gradlew :${MODULE}:dependencies --no-daemon | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # 3. 소스코드 전체 복사 | ||||||||||||||||||||||||||||||||||||
| # 4. 소스코드 전체 복사 | ||||||||||||||||||||||||||||||||||||
| COPY . . | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # 4. 실제 애플리케이션 빌드 | ||||||||||||||||||||||||||||||||||||
| # 5. 실제 애플리케이션 빌드 | ||||||||||||||||||||||||||||||||||||
| RUN ./gradlew :${MODULE}:bootJar --parallel --no-daemon | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # Run stage | ||||||||||||||||||||||||||||||||||||
|
|
@@ -29,6 +33,6 @@ COPY --from=build /app/${MODULE}/build/libs/${MODULE}-*.jar app.jar | |||||||||||||||||||||||||||||||||||
| COPY --from=build /app/secret ./secret/ | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # JVM 실행 설정 | ||||||||||||||||||||||||||||||||||||
| # Xms512m: 초기 힙 메모리 512MB | ||||||||||||||||||||||||||||||||||||
| # Xmx1g: 최대 힙 메모리 1GB | ||||||||||||||||||||||||||||||||||||
| # - Xms512m: 초기 힙 메모리 512MB | ||||||||||||||||||||||||||||||||||||
| # - Xmx1g: 최대 힙 메모리 1GB | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) 메모리 옵션을 ENV 로 분리 제안
ENV JAVA_OPTS="-Xms512m -Xmx1g"
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar app.jar"]운영 환경별로 JVM 옵션을 주입해야 할 경우 유연성이 커집니다. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| ENTRYPOINT ["java", "-Xms512m", "-Xmx1g", "-jar", "app.jar"] | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
RUN 결합으로 레이어 축소 가능
dev Dockerfile와 동일하게
chmod+ 의존성 다운로드를 하나의 RUN으로 합칠 수 있습니다. 필요 시 참고하십시오.🤖 Prompt for AI Agents