CI/CD 파이프라인 구성 추가#41
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a multi-stage Dockerfile for building and running a Spring Boot application with Gradle 9.4.1 and JDK 21. The review feedback highlights three key improvements: handling potential build failures caused by multiple JAR files (including the plain JAR) matching the wildcard copy, ensuring the Gradle wrapper has execution permissions to avoid permission denied errors, and optimizing the Docker image layers by using the --chown flag directly within the COPY instruction.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
|
||
| COPY src src | ||
|
|
||
| RUN ./gradlew bootJar --no-daemon --parallel -x test |
There was a problem hiding this comment.
Spring Boot 2.5 버전 이상부터는 기본적으로 일반 jar(*-plain.jar)와 실행 가능한 bootJar가 함께 생성됩니다. 이로 인해 build/libs/ 디렉토리에 2개의 jar 파일이 존재하게 되며, 이후 런타임 스테이지에서 COPY --from=builder /app/build/libs/*.jar app.jar 수행 시 와일드카드 패턴에 여러 파일이 매칭되어 빌드가 실패하게 됩니다.\n\n이를 방지하기 위해 빌드 단계에서 plain jar를 제외한 실행 가능한 jar 파일을 app.jar라는 고정된 이름으로 복사해두는 과정을 추가하는 것이 좋습니다. 이렇게 하면 버전 변경 시에도 Dockerfile을 수정할 필요가 없어집니다.
RUN ./gradlew bootJar --no-daemon --parallel -x test && \
cp build/libs/$(ls build/libs | grep -v plain) build/libs/app.jar
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY gradlew . |
| COPY --from=builder /app/build/libs/*.jar app.jar | ||
|
|
||
| RUN chown aikon:aikon app.jar |
✨ 작업 내용
GitHub Actions 기반 CI/CD 파이프라인을 구성했습니다.
🔍 리뷰 시 참고사항
ENVFILE시크릿 하나로 관리합니다. 서버에.aikon.env로 기록되고--env-file로 컨테이너에 주입됩니다.✅ 체크리스트
.env.example등) 변경이 필요한 경우 작성 또는 수정했나요?📎 관련 이슈(선택)