Skip to content

chore: 배포 이미지 빌드를 러너 Gradle + layered jar로 바꾸고, 배포 후 헬스체크를 기다린다 - #169

Merged
ff1451 merged 1 commit into
mainfrom
chore/faster-deploy
Oct 18, 2026
Merged

ff1451 merged 1 commit into
mainfrom
chore/faster-deploy

Conversation

@ff1451

@ff1451 ff1451 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

왜

배포 한 번에 약 1분 50초가 걸리고, 그중 이미지 빌드·push가 76초입니다. 원인은 두 가지입니다.

  • Docker 안에서 Gradle이 매번 의존성 해석·컴파일을 처음부터 합니다.
  • fat jar 86MB(그중 의존성 81MB)를 레이어 하나에 넣어서, 매번 GHCR에 push하고 서버가 pull합니다.

또 docker run -d 직후 성공으로 끝나서, 앱이 기동에 실패해도 Actions에는 성공으로 표시됐습니다.

바꾼 것

  • 빌드: jar를 러너에서 setup-gradle 캐시로 빌드하고, jarmode=tools extract --layers --launcher로 풉니다.
  • Dockerfile: 빌드 스테이지를 없애고 layer를 바뀌는 빈도가 낮은 순서로 COPY합니다. 배포마다 보통 application 레이어(약 3MB)만 새로 올라갑니다. JVM 옵션은 그대로이고, 진입점만 JarLauncher로 바뀝니다.
  • 배포 스텝: /health가 200이 될 때까지 최대 120초 기다립니다. 못 뜨면 job이 실패합니다.
    • 공개 레포라 실패해도 앱 로그는 Actions에 남기지 않고, 컨테이너 상태(exit code·OOM·재시작 횟수)만 출력합니다.
    • 헬스체크는 컨테이너 안의 busybox wget으로 하므로, 서버에 curl이 필요 없습니다.
  • CI: image job을 추가했습니다. 같은 방식으로 이미지를 만들고 Postgres와 함께 띄워 /health를 확인합니다. 테스트 job과 병렬로 돕니다.

로컬 확인

  • 추출한 layer를 합쳐 JarLauncher로 실행하면 앱이 기동해 Flyway의 DB 연결 단계까지 가는 것을 확인했습니다(로컬 Docker 없음).
  • 실제 이미지 기동은 이 PR의 CI image job으로 확인합니다.

주의

  • 로컬에서 docker build를 하려면 jar를 먼저 빌드·추출해야 합니다(Dockerfile 상단 주석).
  • 머지하면 바로 이 워크플로로 운영 배포가 돕니다. 남은 PR을 모두 머지한 뒤 맨 마지막에 머지하고 지켜봅니다.

- jar를 러너에서 setup-gradle 캐시로 빌드한다. Docker 안에서 매번 의존성 해석·컴파일을 처음부터 하던 것을 없앤다.
- jar를 layer(dependencies 81MB / application 3MB 등)로 풀어 이미지에 담는다. 배포마다 바뀌는 앱 레이어만
  GHCR에 push되고 서버가 pull한다.
- docker run -d 직후 끝나던 배포 스텝이 /health 200까지 기다린다(최대 120초). 못 뜨면 job이 실패한다.
  공개 레포라 실패 시 앱 로그 대신 컨테이너 상태(exit code, OOM, 재시작 횟수)만 출력한다.
- CI에 이미지 스모크 테스트 job을 추가한다(Postgres와 함께 띄워 /health 확인, 테스트 job과 병렬).
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b695ce67-8898-4e2e-8764-c1949b61985d
📥 Commits

Reviewing files that changed from the base of the PR and between 4050438 and 0c208ce.

📒 Files selected for processing: 4
  • .dockerignore
  • .github/workflows/ci.yml
  • .github/workflows/deploy.yml
  • Dockerfile
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ff1451
ff1451 marked this pull request as ready for review October 18, 2026 13:35
@ff1451
ff1451 merged commit 7cd5816 into main Oct 18, 2026
2 of 3 checks passed
@ff1451
ff1451 deleted the chore/faster-deploy branch October 18, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant