Skip to content

도커 기반 개발 서버 배포 자동화#196

Merged
zionhann merged 3 commits intoHandongSF:mainfrom
zionhann:feat/docker-runtime-packaging
Mar 5, 2026
Merged

도커 기반 개발 서버 배포 자동화#196
zionhann merged 3 commits intoHandongSF:mainfrom
zionhann:feat/docker-runtime-packaging

Conversation

@zionhann
Copy link
Member

@zionhann zionhann commented Mar 4, 2026

  • Docker 이미지 빌드 및 런타임 실행 구성을 정식 추가했습니다

    멀티스테이지 Dockerfile과 .dockerignore를 도입해 빌드 산출물과 런타임 이미지를 분리하고 배포 아티팩트 생성 과정을 표준화했습니다. 최종 컨테이너는 비특권 사용자로 실행되도록 조정해 운영 보안 기본값을 강화했습니다. docker-compose.yml에는 이미지, 포트, 설정 파일 마운트, 볼륨을 선언해 서버에서 동일한 명세로 재기동할 수 있게 했습니다. 이를 통해 로컬/서버 간 실행 편차를 줄이고 운영 재현성을 확보했습니다.

  • GitHub Actions 워크플로를 테스트-이미지-배포트리거 흐름으로 정리했습니다

    main 브랜치 푸시에서만 Docker 이미지 빌드/푸시와 Jenkins 웹훅 호출이 동작하도록 조건을 명확히 분리했습니다. 이미지 태그는 sha-7자리와 dev를 함께 발행해 추적 가능한 배포 태그와 개발 편의 태그를 동시에 제공하도록 구성했습니다. Jenkins 웹훅 단계는 비차단으로 유지해 개인 서버 상태가 CI 실패로 전파되지 않도록 했습니다. 또한 조건식에서 secrets 직접 참조 이슈를 env 기반으로 보완해 실행 안정성을 높였습니다.

  • Jenkins 배포 파이프라인의 트리거 검증과 Compose 주입 방식을 보강했습니다

    웹훅 payload의 event, branch, sha, sha_ref를 교차 검증해 의도한 이미지와 커밋 조합만 배포되도록 제한했습니다. 최신 main 기준으로 오래된 배포 요청은 자동 스킵하도록 분기해 경쟁 배포로 인한 롤백 위험을 줄였습니다. 배포 시에는 Jenkins credential env 파일을 사용하고 IMAGE_REF를 런타임으로 합성해 Compose 변수 주입 누락을 방지했습니다. 이후 서비스 실행 상태를 확인하는 검증 단계를 추가해 배포 성공 판정의 신뢰도를 높였습니다.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 애플리케이션의 Docker 빌드 및 실행 환경을 구축합니다. 멀티스테이지 Dockerfile을 통해 효율적인 컨테이너 이미지 빌드 프로세스를 정의하고, .dockerignore를 사용하여 빌드 컨텍스트를 최적화합니다. 또한, docker-compose.yml을 도입하여 개발 및 배포 환경에서 애플리케이션을 일관되고 재현 가능하게 실행할 수 있도록 지원합니다.

Highlights

  • Docker 빌드 구성 추가: 멀티스테이지 Dockerfile과 .dockerignore를 추가하여 애플리케이션을 컨테이너 이미지로 일관되게 빌드할 수 있도록 구성했습니다. gradlew 실행 권한을 보정하고 bootJar를 직접 실행하도록 하여 CI 환경에서도 이미지 빌드가 안정적으로 수행되도록 맞췄습니다.
  • Compose 기반 실행 구성 추가: docker-compose.yml을 추가하여 레지스트리 이미지 실행 구성을 코드로 관리할 수 있게 했습니다. IMAGE_REF 환경변수로 배포 대상을 주입하고 런타임 환경변수 및 볼륨 구성을 함께 선언하여 개발 서버 실행 조건을 재현 가능하게 정리했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .dockerignore
    • Docker 빌드 시 불필요한 파일 및 디렉토리(예: .git, .gradle, build)를 제외하도록 구성했습니다.
  • Dockerfile
    • 멀티스테이지 빌드를 사용하여 애플리케이션 JAR 파일을 빌드하고 최종 실행 이미지를 생성하도록 정의했습니다.
    • gradlew 실행 권한을 부여하고 bootJar 태스크를 실행하여 애플리케이션을 패키징합니다.
    • api-docs.yaml 파일을 정적 리소스 경로로 이동시키는 로직을 포함했습니다.
    • amazoncorretto:17 이미지를 기반으로 애플리케이션을 실행하도록 설정했습니다.
  • docker-compose.yml
    • webapp 서비스를 정의하여 Docker Compose를 통해 애플리케이션을 실행하도록 구성했습니다.
    • IMAGE_REF 환경변수를 통해 이미지 태그를 동적으로 설정할 수 있도록 했습니다.
    • SPRING_PROFILES_ACTIVE, CUSTOM_RESOURCE_LOCATION, LOG_PATH 등 런타임 환경변수를 설정했습니다.
    • webapp_images 및 webapp_logs 볼륨을 정의하여 영속적인 데이터 저장을 지원합니다.
Activity
  • 이 Pull Request에 대한 활동 내역이 없습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

Docker 지원이 추가됨. Dockerfile과 docker-compose.yml이 생성되어 Java 애플리케이션의 컨테이너화를 정의하고, GitHub Actions 워크플로우가 GHCR으로 이미지를 푸시하며 Jenkins 알림을 지원하도록 업데이트됨.

Changes

Cohort / File(s) Summary
Docker 설정 파일
.dockerignore, Dockerfile, docker-compose.yml
버전 관리, IDE, 빌드 아티팩트를 제외하는 .dockerignore 추가. 멀티스테이지 Dockerfile로 Java 애플리케이션을 컨테이너화하며, amazoncorretto:17 기반 빌더와 런타임 스테이지 포함. docker-compose.yml으로 webapp 서비스 정의, 포트 8080 노출, 이미지 및 로그 볼륨 마운트, unless-stopped 재시작 정책 설정.
CI/CD 파이프라인
.github/workflows/gradle.yml
워크플로우 이름을 "Java CI with Gradle"에서 "CI"로 변경. 기존 "build" 작업을 "test"로 이름 변경. Gradle 캐시 추가, gradlew 실행 권한 보장 스텝 추가. 새로운 "docker" 작업 추가: main 브랜치 푸시 시에만 실행되며 Docker Buildx 설정, GHCR 로그인, 이미지 빌드 및 푸시 수행. 새로운 "jenkins" 작업 추가: docker 작업 후 실행되며 Jenkins 웹훅 트리거 지원.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed PR 제목이 Docker 기반 개발 서버 배포 자동화라는 주요 변경 사항을 명확하게 반영하고 있으며, 변경 사항의 핵심 내용과 일치합니다.
Description check ✅ Passed PR 설명이 Docker 빌드 구성, GitHub Actions 워크플로 개선, docker-compose 추가 등 실제 변경 사항들과 관련이 있으며 각 변경의 의도를 명확히 설명하고 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

@zionhann zionhann changed the title 도커 이미지 빌드 및 실행 구성을 추가합니다 도커 기반 CI 및 실행 구성을 추가합니다 Mar 4, 2026
Copy link

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

Choose a reason for hiding this comment

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

Code Review

이 PR은 애플리케이션의 도커 이미지 빌드 및 실행 구성을 추가하여 개발 및 배포 프로세스를 표준화하는 데 크게 기여합니다. 멀티스테이지 Dockerfile은 효율적인 이미지 빌드를 보장하며, .dockerignore 파일은 불필요한 파일을 빌드 컨텍스트에서 제외하여 빌드 속도를 향상시킵니다. docker-compose.yml은 환경 변수와 명명된 볼륨을 사용하여 유연하고 재현 가능한 로컬 개발 환경을 제공합니다. 그러나 주요 보안 문제로 애플리케이션이 컨테이너 내에서 root 사용자로 실행되어 최소 권한 원칙을 위반합니다. 잠재적인 침해의 영향을 완화하기 위해 비특권 사용자를 생성하고 사용하는 것이 좋습니다.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
docker-compose.yml (1)

4-4: container_name 고정은 선택적으로 제거를 권장합니다.

고정 이름은 동일 호스트에서 다중 스택 실행 시 충돌하고, 스케일링 유연성도 낮춥니다.

♻️ 제안 diff
-    container_name: webapp
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker-compose.yml` at line 4, Remove the fixed container name declaration to
avoid collisions and improve scaling: locate the "container_name: webapp" entry
in the compose service and either delete it or convert it to a configurable
value (e.g., driven by an environment variable or override) so the container
name is not hardcoded; update any docs or deployment scripts that depended on
the hardcoded name to use the new configurable/omitted naming.
.dockerignore (1)

1-7: 민감 파일 패턴도 빌드 컨텍스트에서 제외하는 것이 안전합니다.

현재 패턴은 기본 산출물 제외는 잘 되어 있습니다. 여기에 .env*, *.pem, *.key 같은 비밀정보 후보도 추가해두면 Docker 컨텍스트 유출 위험을 더 줄일 수 있습니다.

🔒 제안 diff
 .git
 .github
 .gradle
 .gradle-home
 build
 out
 *.iml
+.env
+.env.*
+*.pem
+*.key
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.dockerignore around lines 1 - 7, Update the .dockerignore file to also
exclude common sensitive file patterns to reduce Docker build context leaks: add
entries such as .env*, *.pem, *.key, *.p12, *.jks, *.crt, id_rsa, id_rsa.pub,
.aws, .gnupg, and any other private key/certificate or credential filenames in
addition to the existing patterns (.git, .github, build, out, *.iml) so those
secrets are never sent to the Docker daemon during image builds.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/gradle.yml:
- Around line 98-105: The step's if expression incorrectly references the
secrets context directly (if: secrets.JENKINS_WEBHOOK_URL != ''), which GitHub
Actions disallows; instead, set the secret into an environment variable at the
job/step env (e.g., JENKINS_WEBHOOK_URL already present) and change the
conditional to check that env variable (if: env.JENKINS_WEBHOOK_URL !=
'')—update the step that defines env: JENKINS_WEBHOOK_URL, BRANCH, SHA, SHA_REF
and replace the if condition accordingly so the CI uses env.JENKINS_WEBHOOK_URL
for the guard.

In `@Dockerfile`:
- Around line 15-25: Create and switch to a non-root user in the Dockerfile: add
a system user (e.g., "app") and group, chown the WORKDIR and created subdirs
(image, log) and the copied artifact so they are writable by that user, then add
USER app before ENTRYPOINT; reference the Dockerfile symbols WORKDIR, RUN mkdir
-p image log, COPY --from=builder /project/build/libs/*.jar app.jar, and
ENTRYPOINT to locate where to add the user creation, chown commands and the USER
instruction.

---

Nitpick comments:
In @.dockerignore:
- Around line 1-7: Update the .dockerignore file to also exclude common
sensitive file patterns to reduce Docker build context leaks: add entries such
as .env*, *.pem, *.key, *.p12, *.jks, *.crt, id_rsa, id_rsa.pub, .aws, .gnupg,
and any other private key/certificate or credential filenames in addition to the
existing patterns (.git, .github, build, out, *.iml) so those secrets are never
sent to the Docker daemon during image builds.

In `@docker-compose.yml`:
- Line 4: Remove the fixed container name declaration to avoid collisions and
improve scaling: locate the "container_name: webapp" entry in the compose
service and either delete it or convert it to a configurable value (e.g., driven
by an environment variable or override) so the container name is not hardcoded;
update any docs or deployment scripts that depended on the hardcoded name to use
the new configurable/omitted naming.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2ec90578-1228-4aca-9aba-c326add7f7fc

📥 Commits

Reviewing files that changed from the base of the PR and between ed8226c and 9940e76.

📒 Files selected for processing (4)
  • .dockerignore
  • .github/workflows/gradle.yml
  • Dockerfile
  • docker-compose.yml

@zionhann zionhann changed the title 도커 기반 CI 및 실행 구성을 추가합니다 도커 기반 개발 서버 배포 자동화 Mar 5, 2026
@zionhann zionhann merged commit 73224e8 into HandongSF:main Mar 5, 2026
4 checks passed
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