-
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
Conversation
📝 Walkthrough## Walkthrough
Dockerfile과 Dockerfile-dev 파일이 Kotlin DSL 기반의 Gradle 빌드 파일(`build.gradle.kts`, `settings.gradle.kts`)을 사용하도록 변경되었습니다. Gradle Wrapper 스크립트와 디렉터리 복사, 실행 권한 부여 단계가 명시적으로 추가되었으며, 단계별 주석이 이에 맞게 수정되었습니다.
## Changes
| 파일(들) | 변경 요약 |
|-------------------------|-------------------------------------------------------------------|
| Dockerfile, Dockerfile-dev | Groovy DSL에서 Kotlin DSL Gradle 빌드 파일로 전환, Gradle Wrapper 파일 및 디렉터리 명시적 복사, gradlew 실행 권한 부여 단계 추가, 단계별 주석 수정, JVM 메모리 설정 주석 형식 변경(Dockerfile-dev) |
## Suggested labels
`⚙️ chore`
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 6
🔭 Outside diff range comments (1)
.github/workflows/dev-ci-cd.yml (1)
27-33: 시크릿 파일이 Docker build context로 노출됩니다
mkdir ./secret후 곧바로docker build를 실행하므로, 시크릿이 레이어에 스쿼시되어 영구 보존됩니다.--secret(BuildKit) 또는actions/download-artifact후--mount=type=ssh등으로 교체하세요.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/dev-ci-cd.yml(5 hunks).github/workflows/prod-ci-cd.yml(5 hunks)Dockerfile(1 hunks)Dockerfile-dev(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: hoonyworld
PR: YAPP-Github/26th-App-Team-1-BE#17
File: .github/workflows/ci-pr.yml:8-9
Timestamp: 2025-07-01T09:50:45.498Z
Learning: hoonyworld 사용자는 Naver 코드 포맷터를 사용하며, 이 포맷터는 YAML 배열의 대괄호 내부에 자동으로 여분의 공백을 추가하는 특성이 있음.
🪛 Checkov (3.2.334)
Dockerfile
[LOW] 1-34: Ensure that HEALTHCHECK instructions have been added to container images
(CKV_DOCKER_2)
[LOW] 1-34: Ensure that a user for the container has been created
(CKV_DOCKER_3)
🔇 Additional comments (2)
.github/workflows/dev-ci-cd.yml (1)
75-76:head -n1사용 시 태그 선택이 불확실
docker/metadata-action@v5는 태그 순서를 보장하지 않습니다. 특정 태그를 사용하려면steps.meta.outputs.tags_json | jq로 필터링하거나, 애초에 단일 태그만 출력하도록 설정하세요..github/workflows/prod-ci-cd.yml (1)
76-78:IMAGE_TAG/VERSION_TAG불일치 가능성
head -n1로 추출한 태그가 semver-tag가 아닐 수 있습니다.VERSION_TAG와 혼용되면 배포 스크립트에서 잘못된 이미지가 풀릴 위험이 있습니다. meta action의version또는labels출력을 일관되게 사용하세요.
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.
Actionable comments posted: 1
♻️ Duplicate comments (2)
Dockerfile-dev (2)
28-29: 시크릿을 이미지에 영구 포함 — 이전 리뷰에서 이미 지적됨
COPY --from=build /app/secret ./secret/로 인해 모든 환경용 시크릿이 최종 이미지에 박제됩니다. 퍼블릭 레지스트리에 노출될 수 있으므로 BuildKit--secret(또는 런타임 볼륨 마운트)으로 대체하세요.
21-34: HEALTHCHECK·비-root USER 누락 — 보안·운용성 개선 권장
컨테이너 헬스체크와 비-root 실행이 여전히 없습니다. 아래와 같이 간단히 보완할 수 있습니다.+# 컨테이너 헬스체크 +HEALTHCHECK CMD curl -f http://localhost:8080/actuator/health || exit 1 + +# 비-root 사용자로 실행 +RUN useradd -u 10001 spring && chown -R spring:spring /app +USER spring
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
Dockerfile-dev(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: hoonyworld
PR: YAPP-Github/26th-App-Team-1-BE#17
File: .github/workflows/ci-pr.yml:8-9
Timestamp: 2025-07-01T09:50:45.498Z
Learning: hoonyworld 사용자는 Naver 코드 포맷터를 사용하며, 이 포맷터는 YAML 배열의 대괄호 내부에 자동으로 여분의 공백을 추가하는 특성이 있음.
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.
Actionable comments posted: 1
♻️ Duplicate comments (4)
Dockerfile (2)
32-33: 시크릿 영구 포함 문제(dev와 동일)프로덕션 이미지에도 시크릿이 bake-in 됩니다. 운영환경 자격증명이 공개될 수 있으니 제거/마운트 방식으로 전환하세요.
35-38: HEALTHCHECK·USER 추가 권장운영 이미지에도 동일 조치를 권장드립니다.
Dockerfile-dev (2)
32-33: 시크릿이 이미지에 영구적으로 포함됩니다
COPY --from=build /app/secret ./secret/는 모든 환경용 시크릿을 최종 이미지에 굳혀 넣습니다. 이미지가 퍼블릭 레지스트리에 올라가면 즉시 유출입니다. 런타임 마운트(예:docker run -v secret:/app/secret)나 BuildKit--secret옵션으로 교체하세요.
35-38: HEALTHCHECK·비-root USER 누락보안·가용성 베스트프랙티스를 위해 아래 두 줄을 추가하는 것을 권장합니다.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
Dockerfile(1 hunks)Dockerfile-dev(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: hoonyworld
PR: YAPP-Github/26th-App-Team-1-BE#17
File: .github/workflows/ci-pr.yml:8-9
Timestamp: 2025-07-01T09:50:45.498Z
Learning: hoonyworld 사용자는 Naver 코드 포맷터를 사용하며, 이 포맷터는 YAML 배열의 대괄호 내부에 자동으로 여분의 공백을 추가하는 특성이 있음.
🪛 Hadolint (2.12.0)
Dockerfile
[info] 16-16: Multiple consecutive RUN instructions. Consider consolidation.
(DL3059)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build-validation
🔇 Additional comments (5)
Dockerfile (2)
7-10: Kotlin DSL 변경사항이 정확하게 적용되었습니다.PR 목표인 Gradle 빌드 파일 확장자를
.kts로 변경하는 작업이 올바르게 수행되었습니다. Gradle Wrapper 파일들도 함께 복사되어 빌드 실패 문제가 해결되었습니다.
12-13: Gradle Wrapper 실행 권한 설정이 올바르게 추가되었습니다.
chmod +x gradlew명령이 추가되어 빌드 스테이지에서 Gradle Wrapper를 정상적으로 실행할 수 있게 되었습니다.Dockerfile-dev (3)
7-10: Kotlin DSL 변경사항이 정확하게 적용되었습니다.개발용 Dockerfile에서도 PR 목표인 Gradle 빌드 파일 확장자를
.kts로 변경하는 작업이 올바르게 수행되었습니다. 이전 리뷰에서 지적된 Gradle Wrapper 파일 누락 문제도 해결되었습니다.
12-13: Gradle Wrapper 실행 권한 설정이 올바르게 추가되었습니다.이전 리뷰에서 제안된
chmod +x gradlew명령이 정확하게 추가되어 빌드 실패 문제가 해결되었습니다.
36-37: 주석 스타일 개선이 적용되었습니다.JVM 설정 관련 주석이 멀티라인 스타일로 변경되어 가독성이 향상되었습니다.
|
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.
Actionable comments posted: 3
♻️ Duplicate comments (1)
Dockerfile (1)
32-33: 시크릿 영구 포함 문제(이전 리뷰와 동일)
COPY --from=build /app/secret ./secret/로 인해 모든 환경용 시크릿이 이미지에 그대로 남습니다.
오픈 레지스트리에 푸시되는 순간 유출 위험이 있으니 BuildKit--secret또는 런타임 볼륨 마운트로 전환하는 것을 강력히 권장합니다.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
Dockerfile(1 hunks)Dockerfile-dev(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: hoonyworld
PR: YAPP-Github/26th-App-Team-1-BE#17
File: .github/workflows/ci-pr.yml:8-9
Timestamp: 2025-07-01T09:50:45.498Z
Learning: hoonyworld 사용자는 Naver 코드 포맷터를 사용하며, 이 포맷터는 YAML 배열의 대괄호 내부에 자동으로 여분의 공백을 추가하는 특성이 있음.
🪛 Hadolint (2.12.0)
Dockerfile
[info] 16-16: Multiple consecutive RUN instructions. Consider consolidation.
(DL3059)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build-validation
🔇 Additional comments (2)
Dockerfile-dev (1)
7-10:.gradle.kts파일 및 Wrapper 사전 복사 → 👍Groovy DSL → Kotlin DSL 전환에 따라 필요한 파일을 정확히 복사하고 있어 빌드 캐시가 깨지지 않습니다.
추가적으로, 모듈이 서브-디렉터리를 더 포함할 경우를 대비해COPY ${MODULE}/build.gradle.kts패턴이 의도와 맞는지 한 번만 더 확인하세요.Dockerfile (1)
7-10: Kotlin DSL 전환 사항 정확히 반영 → 👌
.gradle.kts및 Wrapper 복사 순서가 올바르며 캐싱 전략도 유지됩니다.
| # - Xms512m: 초기 힙 메모리 512MB | ||
| # - Xmx1g: 최대 힙 메모리 1GB |
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)
메모리 옵션을 ENV 로 분리 제안
ENTRYPOINT 인수에 직접 힙 옵션을 박아두면 변경 시 불필요한 이미지 재빌드가 발생합니다.
ENV JAVA_OPTS="-Xms512m -Xmx1g"
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar app.jar"]운영 환경별로 JVM 옵션을 주입해야 할 경우 유연성이 커집니다.
🤖 Prompt for AI Agents
In Dockerfile-dev around lines 36 to 37, the JVM heap memory options are
hardcoded directly in the ENTRYPOINT, causing unnecessary image rebuilds when
changed. Refactor by moving the heap memory options into an ENV variable named
JAVA_OPTS, then update the ENTRYPOINT to use this variable. This allows easier
modification of JVM options per environment without rebuilding the image.
| # 2. Gradle Wrapper 실행 권한 부여 | ||
| RUN chmod +x gradlew | ||
|
|
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 레이어 병합 고려
RUN chmod +x gradlew 뒤에 바로 의존성 다운로드를 이어서 실행하면 레이어 하나를 줄일 수 있습니다.
-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
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # 2. Gradle Wrapper 실행 권한 부여 | |
| RUN chmod +x gradlew | |
| # 의존성 캐싱 최적화를 위한 단계별 복사 | |
| # 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-3. Wrapper 실행권한 부여 후 의존성만 다운로드 | |
| RUN chmod +x gradlew \ | |
| && ./gradlew :${MODULE}:dependencies --no-daemon | |
| # 4. 소스코드 전체 복사 (secret 폴더 포함) | |
| COPY . . | |
| # 5. 실제 애플리케이션 빌드 | |
| RUN ./gradlew :${MODULE}:bootJar --parallel --no-daemon |
🤖 Prompt for AI Agents
In Dockerfile-dev around lines 12 to 14, the RUN command for setting execute
permission on gradlew should be combined with the subsequent dependency download
command into a single RUN statement. This reduces the number of image layers and
saves space without affecting cache efficiency. Modify the Dockerfile to merge
these commands using '&&' so they run in one layer.
| # 2. Gradle Wrapper 실행 권한 부여 | ||
| RUN chmod +x gradlew | ||
|
|
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
In Dockerfile around lines 12 to 14, the RUN command for setting execute
permission on gradlew can be combined with the dependency download RUN command
to reduce image layers. Locate the RUN command that downloads dependencies and
merge the chmod +x gradlew command into it using && to execute both in a single
RUN instruction.



🔗 관련 이슈
📘 작업 유형
📙 작업 내역
🧪 테스트 내역
🎨 스크린샷 또는 시연 영상 (선택)
✅ PR 체크리스트
💬 추가 설명 or 리뷰 포인트 (선택)
Summary by CodeRabbit