Skip to content

[8주차] 조연준/[feat] Docker Compose & CI/CD#320

Open
yeonjuncho wants to merge 3 commits into
Leets-Official:조연준/mainfrom
yeonjuncho:조연준/8주차

Hidden character warning

The head ref may contain hidden characters: "\uc870\uc5f0\uc900/8\uc8fc\ucc28"
Open

[8주차] 조연준/[feat] Docker Compose & CI/CD#320
yeonjuncho wants to merge 3 commits into
Leets-Official:조연준/mainfrom
yeonjuncho:조연준/8주차

Conversation

@yeonjuncho
Copy link
Copy Markdown

@yeonjuncho yeonjuncho commented May 26, 2026

작업 내용

  • Docker 기반 배포 환경을 구성했습니다.
  • Spring Boot 애플리케이션 실행을 위한 Dockerfile을 작성했습니다.
  • MySQL과 애플리케이션을 함께 실행하기 위한 docker-compose.yml을 작성했습니다.
  • GitHub Actions를 이용한 CI/CD workflow를 추가했습니다.
  • GitHub Actions Secret을 통해 배포 환경 설정값을 주입하도록 구성했습니다.

주요 변경 사항

Dockerfile

  • Gradle 기반 Spring Boot 프로젝트를 JAR로 빌드합니다.
  • 빌드된 JAR 파일을 Java 17 런타임 이미지에서 실행합니다.
  • 애플리케이션 포트 8081을 노출합니다.

docker-compose.yml

  • mysql:8.0 이미지 기반 MySQL 컨테이너를 구성했습니다.
  • Dockerfile로 빌드한 Spring Boot 앱 컨테이너를 구성했습니다.
  • 앱 컨테이너가 MySQL 컨테이너의 healthcheck 이후 실행되도록 설정했습니다.
  • 환경변수를 통해 DB, JWT, Kakao 설정값을 주입하도록 구성했습니다.

cicd.yml

  • push 또는 PR 시 GitHub Actions workflow가 실행됩니다.
  • Gradle test를 수행합니다.
  • Docker 이미지를 빌드하고 Docker Hub에 push합니다.
  • EC2에 SSH 접속 후 docker compose pull, docker compose up -d를 실행합니다.

실행 방법

docker compose up --build -d
image image

@yeonjuncho yeonjuncho requested a review from a team May 26, 2026 12:30
@yeonjuncho yeonjuncho self-assigned this May 26, 2026
Copy link
Copy Markdown

@LGH0507 LGH0507 left a comment

Choose a reason for hiding this comment

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

mysql 포트와, 로컬 포트도 본인 환경에 맞게 잘 적용해서 과제 요구사항을 잘 수행하신 것 같습니다. 고생하셨습니다!

Comment thread docker-compose.yml
restart: always
depends_on:
mysql:
condition: service_healthy
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

healthCheck 조건을 걸어 DB가 안정됐을 때 요청받을 수 있도록 잘 작성하신 것 같습니다👍

Comment on lines +36 to +38
- name: Test
run: ./gradlew 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.

Gradle 테스트를 먼저 실행한 뒤 Docker 이미지를 빌드하는 흐름으로 잘 설계하신 것 같습니다. 고생 많으셨습니다!

jobs:
build:
runs-on: ubuntu-latest
outputs:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GitHub Secrets 설정 여부를 체크하여 can_deploy 출력을 만들고, 이를 조건문(if:)으로 활용해 배포 단계의 실행 여부를 동적으로 제어한 설계가 인상적입니다.

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.

4 participants