Skip to content

chore: clean up Dockerfile#69

Open
ga111o wants to merge 1 commit into
easy-cloud-Knet:stagingfrom
ga111o:chore/cleanup-dockerfile
Open

chore: clean up Dockerfile#69
ga111o wants to merge 1 commit into
easy-cloud-Knet:stagingfrom
ga111o:chore/cleanup-dockerfile

Conversation

@ga111o

@ga111o ga111o commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

  • 사용 안 하는 libvirt-dev / pkg-config 설치 제거
  • CGO_ENABLED=0 정적 빌드 + -trimpath -ldflags="-s -w"로 바이너리 경량화
  • 런타임 이미지를 gcr.io/distroless/static-debian12:nonroot로 교체
  • EXPOSE 8080 -> EXPOSE 8081, docker compose에서 기대하는 값으로 수정
  • 결과: 최종 이미지 크기 14.2MB로 반의반의반토막 냄.

Motivation

  • 불필요한 의존성 제거. 현재는 코어에 libvirt 관련 코드가 전혀 없는데, libvirt-dev/pkg-config 빌드 때, 설치 진행하니 시간과 용량만 잡아먹고 있었습니다.
  • 서버는 config.yamlport: 8081로 리스닝하는데 EXPOSE 8080이었습니다. 왜 불일치가 났었는지는 모르겠네요.
  • 런타임에 Go 툴체인이 통째로 포함된 풀 이미지를 그대로 배포하고 있었습니다.

Approach

  • cgo 의존성이 없음을 확인하고 CGO_ENABLED=0으로 완전 정적 바이너리를 빌드하도록.
    • 셸/패키지가 없는 distroless/static만으로 실행 가능
  • builder(golang:1.24)에서 빌드, runtime(distroless static:nonroot)에 산출물만 복사, uid 65532(nonroot)로 실행해 보안 강화
  • 런타임 의존 파일 보존
    • 설정 폴백 경로(resources/config.yaml)를 위해 resources/ 복사
    • 앱이 logs/에 로그를 기록하므로 nonroot가 쓸 수 있게 --chown=nonroot:nonrootlogs/ 디렉토리 포함
  • go.mod/go.sum을 먼저 복사해 의존성 레이어 캐시 활용
  • .dockerignore 추가로 빌드 컨텍스트에서 .git, *.md, logs/, main 제외

Type of Change

  • Bug fix
  • New feature
  • Refactoring
  • Docs / Config
  • CI/CD

Testing

  • Tested locally
  • No regression in existing functionality

로컬에서 실제 검증 완료:

  • docker build 성공, 최종 이미지 14.2MB
  • distroless/nonroot 환경에서 바이너리 정상 실행, logs/ 쓰기 가능.
  • 설정 로딩이 resources/config.yaml 폴백 경로를 그대로 사용함을 확인.
  • Redis 초기화 단계까지 정상 진입

Checklist

  • Reviewers assigned
  • Related issue linked

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ga111o, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 38 minutes and 32 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 26d0314e-2efc-4707-b36c-42e9c7932160

📥 Commits

Reviewing files that changed from the base of the PR and between c3b4b73 and 0d5ffac.

📒 Files selected for processing (2)
  • .dockerignore
  • Dockerfile
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

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