Skip to content

CI/CD 파이프라인 구성 추가#41

Open
chaeeun-09 wants to merge 8 commits into
developfrom
feat/add-cicd-pipeline
Open

CI/CD 파이프라인 구성 추가#41
chaeeun-09 wants to merge 8 commits into
developfrom
feat/add-cicd-pipeline

Conversation

@chaeeun-09

Copy link
Copy Markdown

✨ 작업 내용

GitHub Actions 기반 CI/CD 파이프라인을 구성했습니다.

  • CI: PR 시 ktlint 검사 → 빌드 → 테스트 순서로 실행
  • CD: main 브랜치 push 시 Docker 이미지 빌드 후 GHCR 푸시 → SSH 배포 자동화
  • Dockerfile 멀티스테이지 빌드 추가 (builder: gradle, runtime: temurin jre alpine)

🔍 리뷰 시 참고사항

  • CD는 main에서만 동작하며 develop에는 CI만 적용됩니다.
  • 환경변수는 ENVFILE 시크릿 하나로 관리합니다. 서버에 .aikon.env로 기록되고 --env-file로 컨테이너에 주입됩니다.
  • 배포 서버에는 Docker와 gh CLI가 설치되어 있어야 합니다.

✅ 체크리스트

  • 문서(README, .env.example 등) 변경이 필요한 경우 작성 또는 수정했나요?
  • 작업한 코드가 정상적으로 동작하는 것을 직접 확인했나요?
  • 필요한 경우 테스트 코드를 작성하거나 수정했나요?
  • Merge 대상 브랜치를 올바르게 설정했나요?
  • PR에 관련 없는 작업이 포함되지 않았나요?
  • 적절한 라벨과 리뷰어를 설정했나요?

📎 관련 이슈(선택)

  • Close #

cfcromn and others added 8 commits June 5, 2026 10:01
* fix :: WebMvcConfigurer 방식을 CorsFilter Bean으로 교체하여 CORS 헤더 누락 수정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix :: frontendPublicBaseUrl 미설정 시 CorsFilter 비활성화

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@chaeeun-09 chaeeun-09 added ⚙ Setting 환경 세팅 🌏 Deploy 배포 관련 labels Jun 18, 2026
@chaeeun-09 chaeeun-09 requested review from cfcromn and jyx-07 June 18, 2026 22:43

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Dockerfile

COPY src src

RUN ./gradlew bootJar --no-daemon --parallel -x test

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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

Comment thread Dockerfile

WORKDIR /app

COPY gradlew .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

gradlew 파일이 복사될 때 실행 권한(+x)이 유실될 수 있습니다. 특히 Windows 환경에서 git 설정(core.filemode)에 따라 권한이 유지되지 않은 채 커밋된 경우, 빌드 단계에서 Permission denied 에러가 발생하며 빌드가 실패할 수 있습니다.\n\n안전한 빌드를 위해 gradlew 복사 후 실행 권한을 명시적으로 부여하는 것을 권장합니다.

COPY gradlew .
RUN chmod +x gradlew

Comment thread Dockerfile
Comment on lines +25 to +27
COPY --from=builder /app/build/libs/*.jar app.jar

RUN chown aikon:aikon app.jar

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

COPY 명령어의 --chown 옵션을 사용하면 별도의 RUN chown 레이어를 생성하지 않고 파일 복사와 권한 설정을 동시에 처리할 수 있어, 이미지 레이어 수를 줄이고 빌드 효율성을 높일 수 있습니다. 또한 앞서 제안드린 대로 빌드 단계에서 단일화된 app.jar를 복사하도록 변경합니다.

COPY --from=builder --chown=aikon:aikon /app/build/libs/app.jar app.jar

@chaeeun-09 chaeeun-09 self-assigned this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌏 Deploy 배포 관련 ⚙ Setting 환경 세팅

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants