Skip to content

[박다슬] sprint11#272

Merged
JiNookk merged 1 commit intocodeit-bootcamp-nodejs:박다슬from
Park-DaSeul:박다슬-sprint11
Dec 3, 2025

Hidden character warning

The head ref may contain hidden characters: "\ubc15\ub2e4\uc2ac-sprint11"
Merged

[박다슬] sprint11#272
JiNookk merged 1 commit intocodeit-bootcamp-nodejs:박다슬from
Park-DaSeul:박다슬-sprint11

Conversation

@Park-DaSeul
Copy link
Collaborator

요구사항

  • Github Actions로 테스트, 배포 자동화
  • Docker 이미지 만들기

Github Actions 활용

  • 브랜치에 pull request가 발생하면 테스트를 실행하는 액션을 구현해 주세요.
  • main 브랜치에 push가 발생하면 AWS 배포를 진행하는 액션을 구현해 주세요.
  • 개인 Github 리포지터리에서 Actions 동작을 확인해 보세요.

Docker 이미지 만들기

  • Express 서버를 실행하는 Dockerfile을 작성해 주세요.
  • Express 서버가 파일 업로드를 처리하는 폴더는 Docker의 Volume을 활용하도록 구현해 주세요.
  • 데이터베이스는 Postgres 이미지를 사용해 연결하도록 구현해 주세요.
  • 실행된 Express 서버 컨테이너는 호스트 머신에서 3000번 포트로 접근 가능하도록 구현해 주세요.

주요 변경사항

  • 깃허브 액션을 사용하여 main에 push가 될 경우 도커를 사용하여 EC2, ECR에 자동으로 업데이트 하고 자동 배포합니다.
  • 도커 컴포즈는 배포에서는 사용할 필요가 없어서. 로컬 개발 할때 사용하는 것으로 생각했습니다.

멘토에게

  • 코드 리뷰 감사합니다.
  • 깃허브 액션도 알겠고, 도커도 조금은 알겠는데 이거를 같이 사용하려니깐 엄청 헷갈리고 어렵네요... 처음 깃 사용하는 느낌입니다.

@Park-DaSeul Park-DaSeul changed the title [feat] docker 및 git action 연결 [박다슬] sprint11 Nov 30, 2025
@Park-DaSeul Park-DaSeul added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Nov 30, 2025
@Park-DaSeul Park-DaSeul requested a review from JiNookk December 1, 2025 07:23
Copy link
Collaborator

@JiNookk JiNookk left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~ 코멘트 한번만 확인 부탁드려요!

@@ -0,0 +1,68 @@
name: PR test Check (DB 포함)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Postgres 컨테이너까지 띄워서 통합 테스트를 안정적으로 실행하는 것 좋네요!

# 1단계: 빌드 스테이지 (Builder Stage)
# ----------------------------------------------------------------------
ARG NODE_VERSION=
FROM node:${NODE_VERSION}-slim AS builder
Copy link
Collaborator

Choose a reason for hiding this comment

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

github action에서는 괜찮을 것 같은데 docker-compose에서는 NODE_VERSION환경변수가 빠져서 보완이 필요할 것 같습니다.

@@ -0,0 +1,37 @@
node_modules
Copy link
Collaborator

Choose a reason for hiding this comment

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

개발 관련 파일, 테스트 파일 잘 제외하셨네요!

id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

오 sha로 태깅한것 훌륭합니다.

-e DATABASE_URL='${{ secrets.DATABASE_URL }}' \
${{ env.IMAGE_URI }}

- name: Remove Runner IP from EC2 Security Group
Copy link
Collaborator

Choose a reason for hiding this comment

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

보안 신경쓴 것 좋습니다!

- '3000:3000'
env_file:
- ./.env
volumes:
Copy link
Collaborator

Choose a reason for hiding this comment

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

전체 소스 마운트하는게 개발환경에서는 편리한데 프로덕션에서는 빌드된 이미지만 포함하는게 좋아요~ 환경을 분리해서 docker-compose를 작성해보면 좋을 것 같습니다!

@JiNookk JiNookk merged commit 77ed165 into codeit-bootcamp-nodejs:박다슬 Dec 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants