-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[25.01.05 / TASK-91] Feature - deploy 세팅 (#8)
* feature: dockerfile 과 github action 에서 docker image CI CD 환경 구성 * modify: readme 수정 * feature: 2차 배포 세팅 * refactor: devDependencies에서 sentry dependencies로 sentry 이동 * hotfix: fixed deploy * hotfix: 로그인 오토필 관련 오류 해결 * modify: standalone 설정을 위한 dockerfile update * modify: git action 에 workflow_dispatch: 추가 * hotfix: 데이터 타입 맞춤 * refactor: 타입 맞춤 * hotfix: env ignore 이슈 해결 * hotfix: 커서 관련 오류 해결 * modify: action version --------- Co-authored-by: six-standard <[email protected]>
- Loading branch information
1 parent
d399a2c
commit a3af846
Showing
9 changed files
with
357 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 23 | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install -g pnpm | ||
pnpm install --frozen-lockfile | ||
- name: Build Next.js application | ||
run: | | ||
pnpm run build | ||
# Docker 로그인 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# Docker 이미지 빌드 | ||
- name: Build Docker Image | ||
run: | | ||
docker build -t velog-dashboard-v2-fe:latest . | ||
# Docker Hub에 푸시 | ||
- name: Push Docker Image | ||
run: | | ||
docker tag velog-dashboard-v2-fe:latest ${{ secrets.DOCKER_USERNAME }}/velog-dashboard-v2-fe:latest | ||
docker push ${{ secrets.DOCKER_USERNAME }}/velog-dashboard-v2-fe:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM node:23-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN npm install -g pnpm pm2 | ||
|
||
# 기존 빌드된 파일들과 필요한 설정 파일들 복사 | ||
COPY next.config.mjs ecosystem.config.js ./ | ||
COPY .next/standalone ./ | ||
COPY .next/static ./.next/static | ||
COPY public ./public | ||
COPY .env ./.env | ||
COPY .env.production ./.env.production | ||
|
||
# 프로덕션 의존성만 설치 | ||
COPY package.json pnpm-lock.yaml ./ | ||
RUN pnpm install --no-frozen-lockfile --prod | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["pm2-runtime", "start", "ecosystem.config.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @ts-nocheck | ||
module.exports = { | ||
apps: [ | ||
{ | ||
name: 'velog-dashboard-v2-fe', | ||
script: 'node', | ||
args: './server.js', | ||
instances: 1, | ||
autorestart: true, | ||
watch: false, | ||
max_memory_restart: '1G', | ||
env: { | ||
NODE_ENV: 'production', | ||
}, | ||
error_file: 'logs/next-err.log', | ||
out_file: 'logs/next-out.log', | ||
log_date_format: 'YYYY-MM-DD HH:mm:ss', | ||
restart_delay: 4000, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.