Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/Chore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Chore - 잡일 처리
description: 환경 설정, 파일 정리 등 기타 해야할 일들
title: "[Chore] "
type: Chore
body:
- type: textarea
attributes:
label: 배경 및 목적
placeholder: 작업의 필요와 목적을 설명해주세요.
validations:
required: true

- type: textarea
attributes:
label: 작업 목록
placeholder: |
- [ ] A 구현
- [ ] B 구현
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/Docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docs - 문서 수정
description: 문서 수정 및 보완
title: "[Docs] "
type: Docs
body:
- type: textarea
attributes:
label: 배경 및 목적
placeholder: 문서 수정의 필요와 목적을 설명해주세요.
validations:
required: true

- type: textarea
attributes:
label: 작업 목록
placeholder: |
- [ ] A 구현
- [ ] B 구현
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/Feat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Feat - 기능 추가
description: 새로운 기능 개발
title: "[Feat] "
type: Feat
body:
- type: textarea
attributes:
label: 배경 및 목적
placeholder: 기능의 필요와 목적을 설명해주세요.
validations:
required: true

- type: textarea
attributes:
label: 기능 명세
placeholder: 기능의 상세 동작 내용을 기술해주세요.
validations:
required: true

- type: textarea
attributes:
label: 성공 기준
placeholder: 기능이 성공적으로 구현되었음을 판단할 기준을 기술해주세요.
validations:
required: true

- type: textarea
attributes:
label: 작업 목록
placeholder: |
- [ ] A 구현
- [ ] B 구현
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/Fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Fix - 버그 수정
description: 버그 상황을 재현하고 수정
title: "[Fix] "
type: Fix
body:
- type: textarea
attributes:
label: 발생 환경
placeholder: 버그가 발생한 환경(운영체제, 브라우저 등)을 기술해주세요.
validations:
required: true

- type: textarea
attributes:
label: 재현 단계
placeholder: 버그를 재현하기 위한 구체적인 단계를 기술해주세요.
validations:
required: true

- type: textarea
attributes:
label: 버그 발생시 결과
placeholder: 버그가 발생했을 때의 구체적인 결과를 기술해주세요.
validations:
required: true

- type: textarea
attributes:
label: 예상 결과
placeholder: 버그가 없을 때 기대되는 정상적인 결과를 기술해주세요.
validations:
required: true

- type: textarea
attributes:
label: 작업 목록
placeholder: |
- [ ] A 구현
- [ ] B 구현
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/Ops.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Ops - 운영 작업
description: 배포, 자동화 등 운영 관련 작업
title: "[Ops] "
type: Ops
body:
- type: textarea
attributes:
label: 배경 및 목적
placeholder: 작업의 필요와 목적을 설명해주세요.
validations:
required: true

- type: textarea
attributes:
label: 작업 목록
placeholder: |
- [ ] A 구현
- [ ] B 구현
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/Ref.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Ref - 리팩토링
description: 코드 스타일, 이름변경, 구조 변경 등 기능 변경이 없는 코드작업
title: "[Ref] "
type: Ref
body:
- type: textarea
attributes:
label: 배경 및 목적
placeholder: 작업의 필요와 목적을 설명해주세요.
validations:
required: true

- type: textarea
attributes:
label: 작업 목록
placeholder: |
- [ ] A 구현
- [ ] B 구현
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test - 테스트
description: 기능, 시스템의 테스트 작업
title: "[Test] "
type: Test
body:
- type: textarea
attributes:
label: 테스트 대상
placeholder: 테스트 대상(기능, 시스템 등)을 설명해주세요.
validations:
required: true

- type: textarea
attributes:
label: 테스트 방법 및 로직
placeholder: 테스트를 수행할 방법과 로직을 기술해주세요.
validations:
required: true

- type: textarea
attributes:
label: 작업 목록
placeholder: |
- [ ] A 구현
- [ ] B 구현
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## 관련 이슈

<!-- 예: Close #123, #321 -->

- 이슈 번호 작성

## 변경 사항

- 이 PR에서 변경된 내용을 간단히 작성

## 배경

- 왜 이 변경이 필요한지
- 관련 논의나 이슈가 있다면 링크

## 구현 상세

- 주요 구현 방식
- 리뷰 시 봐주면 좋은 포인트

## 체크리스트

- [ ] 로컬에서 정상 동작 확인
- [ ] 테스트 코드 추가/수정 (해당 시)
- [ ] 문서 업데이트 (해당 시)
- [ ] 불필요한 코드/주석 제거
82 changes: 82 additions & 0 deletions .github/workflows/deploy-web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: GTRPGM Web CI/CD

on:
push:
branches: [ "main" ]
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

- name: Install dependencies
run: yarn install --frozen-lockfile

# Vite 빌드 (결과물은 dist 폴더에 생성됨)
- name: Build Vite
run: yarn build
env:
VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }}

# 빌드 결과물(dist)과 Dockerfile만 전송
- name: Copy build files via SCP
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_SSH_KEY }}
source: "dist,Dockerfile"
target: "/home/${{ secrets.REMOTE_USER }}/app/web"
rm: true

# 서버에서 Docker 이미지 빌드 및 컨테이너 실행
- name: Deploy via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_SSH_KEY }}
script: |
cd /home/${{ secrets.REMOTE_USER }}/app/web

echo "Backing up old container..."
docker stop web-old || true
docker rm web-old || true
docker rename web web-old || true

echo "Packaging image..."
docker build \
--build-arg WEB_PORT=${{ secrets.WEB_PORT }} \
-t web:latest .

echo "Starting container..."
docker run -d \
--name web \
-p ${{ secrets.WEB_PORT }}:${{ secrets.WEB_PORT }} \
--restart always \
web:latest

sleep 10
if [ "$(docker inspect -f '{{.State.Running}}' web)" = "true" ]; then
echo "✅ 배포 성공: 이전 버전 삭제"
docker stop web-old || true
docker rm web-old || true
else
echo "❌ 배포 실패: 롤백합니다."
docker stop web || true
docker rm web || true
docker rename web-old web || true
docker start web || true
exit 1
fi
docker image prune -f
File renamed without changes.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM nginx:stable-alpine

ARG WEB_PORT

WORKDIR /usr/share/nginx/html
RUN rm -rf ./*

# 빌드된 정적 파일 복사
COPY dist .

# Nginx 설정: 8080 포트 리스닝 및 SPA 라우팅 지원
RUN echo 'server { \
listen ${WEB_PORT}; \
location / { \
root /usr/share/nginx/html; \
index index.html; \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf

EXPOSE ${WEB_PORT}
CMD ["nginx", "-g", "daemon off;"]
File renamed without changes.
88 changes: 88 additions & 0 deletions deploy-web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: ASSA-WEB CI/CD

on:
push:
branches: [ "main" ]
paths:
- 'assa-web/**'

jobs:
build-and-deploy:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./assa-web

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: 'assa-web/yarn.lock'

- name: Install dependencies
run: yarn install --frozen-lockfile

# GitHub Actions 가상 머신에서 빌드
- name: Build Next.js
run: yarn build
env:
NEXT_PUBLIC_SERVER_HOST: ${{ secrets.NEXT_PUBLIC_SERVER_HOST }}

# 빌드 결과물(.next)과 실행에 필요한 파일들만 전송
- name: Copy build files via SCP
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_SSH_KEY }}
# 빌드된 폴더와 실행 파일 전송
source: "assa-web/.next,assa-web/public,assa-web/package.json,assa-web/yarn.lock,assa-web/node_modules,assa-web/Dockerfile"
target: "/home/${{ secrets.REMOTE_USER }}/app/assa-web"
strip_components: 1
rm: true

# 서버에서는 빌드 없이 이미지 생성만 수행
- name: Deploy via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_SSH_KEY }}
script: |
cd /home/${{ secrets.REMOTE_USER }}/app/assa-web

echo "Backing up old container..."
docker stop assa-web-old || true
docker rm assa-web-old || true
docker rename assa-web assa-web-old || true

echo "Packaging image..."
docker build -t assa-web:latest .

echo "Starting container..."
docker run -d \
--name assa-web \
-p 3000:3000 \
--restart always \
assa-web:latest

# 10초 대기 후 상태 확인
sleep 10
if [ "$(docker inspect -f '{{.State.Running}}' assa-web)" = "true" ]; then
echo "✅ 배포 성공: 이전 버전 삭제"
docker stop assa-web-old || true
docker rm assa-web-old || true
else
echo "❌ 배포 실패: 롤백합니다."
docker stop assa-web || true
docker rm assa-web || true
docker rename assa-web-old assa-web || true
docker start assa-web || true
exit 1
fi
docker image prune -f
Loading