Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[25.01.05 / TASK-91] Feature - deploy 세팅 #8

Merged
merged 14 commits into from
Jan 5, 2025
Merged

[25.01.05 / TASK-91] Feature - deploy 세팅 #8

merged 14 commits into from
Jan 5, 2025

Conversation

Nuung
Copy link
Member

@Nuung Nuung commented Jan 5, 2025

  • fe 은 git action 기반 CI/CD 구성, docekr hub 에 image 올려서 compose 에 묶음

Summary by CodeRabbit

  • 새로운 기능

    • Docker 이미지 자동 빌드 및 배포를 위한 GitHub Actions 워크플로우 추가
    • Next.js 애플리케이션의 Docker 컨테이너화 지원
  • 개선 사항

    • React 엄격 모드 활성화
    • 애플리케이션 로깅 및 모니터링 구성 개선
    • 프로젝트 의존성 관리 최적화
    • 폼 유효성 검사 방식 변경
    • 무한 스크롤 쿼리의 페이지 매개변수 처리 개선
    • 사용자 프로필 데이터 접근 방식 간소화
  • 문서

    • Docker 이미지 생성 및 테스트 가이드 추가

@Nuung Nuung added bug Something isn't working enhancement New feature or request labels Jan 5, 2025
@Nuung Nuung requested review from BDlhj and HA0N1 January 5, 2025 14:46
@Nuung Nuung self-assigned this Jan 5, 2025
Copy link

coderabbitai bot commented Jan 5, 2025

Walkthrough

이 풀 리퀘스트는 Velog Dashboard V2 프론트엔드 프로젝트의 Docker 배포 및 빌드 프로세스를 자동화하기 위한 여러 구성 파일을 추가하고 수정했습니다. GitHub Actions 워크플로우, Dockerfile, 생태계 구성, Next.js 설정 등이 포함되어 있으며, 애플리케이션의 빌드, 이미지 생성, 배포 프로세스를 간소화하는 데 중점을 두고 있습니다.

Changes

파일 변경 요약
.github/workflows/docker-publish.yaml Docker 이미지 빌드 및 푸시를 위한 새로운 GitHub Actions 워크플로우 추가
.gitignore 다양한 환경 및 프레임워크에 대한 무시 패턴 추가
Dockerfile Node.js 23-alpine 이미지 기반 컨테이너 빌드 구성
ecosystem.config.js PM2 런타임 설정을 위한 새로운 구성 파일 추가
next.config.mjs React 엄격 모드 활성화 및 독립 실행형 출력 설정
package.json Sentry 종속성 위치 변경
readme.md Docker 이미지 생성 및 테스트 섹션 추가
src/app/(with-tracker)/(login)/Content.tsx useForm 훅의 모드 설정 변경
src/apis/instance.request.ts 오류 처리 및 타입 정의 수정
src/app/(with-tracker)/(auth-required)/main/Content.tsx 무한 쿼리의 페이지 매개변수 처리 개선
src/components/auth-required/Header.tsx 사용자 프로필 데이터 접근 방식 수정
src/types/apis/user.type.ts UserDto 타입 구조 변경

Poem

🐰 도커의 세계로 뛰어들어
깃헙 액션즈 춤을 추네
빌드하고 푸시하며 즐거워
토끼처럼 민첩하게 날아가네
새로운 배포의 길을 열어! 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5fa3a89 and 3f676f9.

📒 Files selected for processing (1)
  • .github/workflows/docker-publish.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/docker-publish.yaml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 4

🧹 Nitpick comments (3)
Dockerfile (1)

19-21: PM2 런타임 사용
PM2를 통해 프로세스 관리가 용이해지고, 재시작 등이 자동화됩니다. 다만, 단순 환경에서는 npm start와 큰 차이가 없을 수 있으니 운영 환경 별로 요구 사항을 고려해 보시면 좋겠습니다.

readme.md (1)

22-39: 로컬 환경 Docker 활용 안내 추가
Docker 이미지를 빌드, 태깅, 푸시, 테스트하는 과정을 친절하게 정리하셨습니다. 협업자 및 사용자가 로컬 개발-운영 단계를 빠르게 파악할 수 있어 좋습니다. 추가적으로 private registry 사용 시 유의사항, .env 구성 시 민감 정보 의존성 등에 대한 간단한 주석을 달아주시면 더 완벽한 가이드가 될 것 같습니다.

.gitignore (1)

1-3: 환경 변수 파일 무시 패턴을 최적화하세요

현재 환경 변수 파일에 대한 무시 패턴이 중복되어 있습니다. 상단의 .env.*와 하단의 개별 .env 파일 패턴이 중복됩니다.

다음과 같이 패턴을 단순화하는 것을 추천드립니다:

# CUSTOM
-.env.*
+.env*
!.env.sample

# dotenv environment variable files
-.env
-.env.development.local
-.env.test.local
-.env.production.local
-.env.local

Also applies to: 162-168

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0548dfc and a4e5a7b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • .github/workflows/docker-publish.yaml (1 hunks)
  • .gitignore (3 hunks)
  • Dockerfile (1 hunks)
  • ecosystem.config.js (1 hunks)
  • next.config.mjs (1 hunks)
  • package.json (1 hunks)
  • readme.md (1 hunks)
  • src/app/(with-tracker)/(login)/Content.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • ecosystem.config.js
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/docker-publish.yaml

15-15: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


18-18: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


33-33: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (7)
next.config.mjs (2)

4-4: React 스트릭트 모드 활성화
리액트 애플리케이션에서 잠재 버그와 비정상 동작을 조기에 탐지할 수 있어 유용합니다. 개발 중에는 일부 메모리 사용량이 증가하거나 경고가 추가될 수 있으므로, 해당 사항을 인지하고 운영 환경에서의 영향도를 주시해 주세요.


6-6: Standalone 출력 옵션 활성화
Docker 환경 등에서 독립 실행형으로 앱을 배포하기에 적합한 설정입니다. 빌드된 산출물이 self-contained 형태로 제공되므로, 배포/호스팅 방식을 단순화할 수 있습니다.

src/app/(with-tracker)/(login)/Content.tsx (1)

22-22: react-hook-form의 검증 모드 변경
mode: 'all'로 설정 시, 모든 입력 이벤트에서 즉시 검증이 이루어져 사용성이 향상될 수 있습니다. 다만, 사용자가 빠르게 입력할 때 간헐적으로 잦은 검증이 부담이 되지 않을지 고려 바랍니다.

Dockerfile (3)

1-5: Node 버전 고정 및 추가 패키지 설치 확인
Node 23 버전을 사용하고 있는데, 특정 기능·보안 이슈를 확인하려면 버전 고정이 필수적일 수 있습니다. 또한 글로벌 설치한 pnpm, pm2가 프로젝트 CI/CD 파이프라인에도 동일하게 적용되는지 검토해 주세요.


7-13: 네이밍 및 구조 확인
.env, .env.production 등 중요한 설정 파일이 Docker 이미지에 그대로 포함됩니다. 비밀 값이 안전하게 관리되고 있는지 다시 한 번 점검해 보시는 것을 권장합니다.


15-17: 프로덕션 의존성만 설치
운영 환경에서 devDependencies를 필요로 하지 않는다면 최적화에 유리합니다. 다만, 서버 실행 시 필요한 빌드 스크립트 등을 devDependencies에서만 제공받지는 않는지 재확인해 주세요.

package.json (1)

15-15: 의존성 이동이 적절합니다

@sentry/nextjsdevDependencies에서 dependencies로 이동한 것은 적절합니다. Sentry는 프로덕션 환경에서 에러 추적을 위해 필요한 런타임 의존성이기 때문입니다.

.github/workflows/docker-publish.yaml Outdated Show resolved Hide resolved
.github/workflows/docker-publish.yaml Outdated Show resolved Hide resolved
.github/workflows/docker-publish.yaml Show resolved Hide resolved
Comment on lines +22 to +26
- name: Install dependencies
run: |
npm install -g pnpm
pnpm install --frozen-lockfile

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

의존성 캐싱 전략을 추가하세요

빌드 시간을 단축하고 효율성을 높이기 위해 pnpm 의존성 캐싱을 추가하는 것이 좋습니다.

      - name: Install dependencies
+       - uses: actions/cache@v4
+         with:
+           path: |
+             ~/.pnpm-store
+             ${{ github.workspace }}/.pnpm-store
+           key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
+           restore-keys: |
+             ${{ runner.os }}-pnpm-
        run: |
          npm install -g pnpm
          pnpm install --frozen-lockfile

Committable suggestion skipped: line range outside the PR's diff.

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: 1

🧹 Nitpick comments (5)
.gitignore (2)

84-86: 환경 변수 파일 패턴 재검토 필요

.env* 패턴이 너무 광범위할 수 있습니다. 특정 환경 변수 파일만 제외하도록 패턴을 구체화하는 것이 좋습니다.

다음과 같이 변경하는 것을 고려해보세요:

-# envs
-.env*
-!.env.sample
+# Environment variables
+.env
+.env.local
+.env.*.local
+!.env.example
+!.env.sample

21-21: 중복된 패턴 정리 필요

.DS_Store.DS_* 패턴이 macOS와 React 섹션에서 중복되어 있습니다.

중복을 제거하고 한 곳에서만 정의하는 것이 좋습니다:

# General
.DS_Store
.AppleDouble
.LSOverride

### react ###
-.DS_*
+# React specific backup files
**/*.backup.*
**/*.back.*

Also applies to: 218-218

src/apis/instance.request.ts (2)

25-25: 에러 필드의 타입 지정
SuccessTypeerror 필드를 null | ErrorType으로 바꾼 것은 에러 정보를 담기에 더 적절해 보입니다. 이로 인해 다른 곳에서 error 필드를 참조하거나 처리하는 로직이 있다면, null 가능성을 고려한 추가 방어 로직이 필요한지 확인해 주세요.


60-60: 에러 컬렉션 인자 error?: Record<string, Error>
HTTP Status Code별로 Error 객체를 매핑하여 던져주는 방식은 유연한 편입니다. 다만, 실제 사용 시 err as Response 캐스팅 부분이 무조건 성공한다는 가정에 의존하고 있으므로, 예외 상황을 대비해 방어 코드를 추가할 수 있는지 고려해보세요.

src/components/auth-required/Header.tsx (1)

89-89: 사용자명 참조 방식 변경
profiles?.user?.username 대신 profiles?.username으로 직접 접근하도록 변경되었습니다. UI나 기타 의존 코드가 정상 동작하는지, 특히 null 또는 undefined 처리에 주의해 주세요.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a4e5a7b and 5fa3a89.

📒 Files selected for processing (5)
  • .gitignore (3 hunks)
  • src/apis/instance.request.ts (2 hunks)
  • src/app/(with-tracker)/(auth-required)/main/Content.tsx (1 hunks)
  • src/components/auth-required/Header.tsx (1 hunks)
  • src/types/apis/user.type.ts (1 hunks)
🔇 Additional comments (4)
src/types/apis/user.type.ts (1)

7-11: UserDto 구조 변경 확인 필요
UserDto 타입에서 기존에 중첩되어 있던 user 객체가 사라지고 최상위 필드로 승격되었습니다. API 응답 처리 로직 및 의존하는 컴포넌트(예: Header 등)와의 호환성을 재검토하시기 바랍니다.

src/apis/instance.request.ts (1)

16-19: 에러 타입 구조 명시
ErrorType 선언이 명확해져서 좋습니다. 하지만 codestatusCode라는 필드가 API 응답 형식과 일치하는지 다시 한번 검토해보시면 좋겠습니다.

src/app/(with-tracker)/(auth-required)/main/Content.tsx (1)

30-38: 페이지 매개변수 구조 간소화
pageParam의 기본값을 빈 문자열로 설정하고, getNextPageParamgetPreviousPageParam을 단순화함으로써 코드 가독성이 좋아졌습니다. 이후 lastPage.nextCursornull일 때 로직이 어떻게 처리되는지(예: 무한 스크롤 로딩 중단 등) 충분히 확인해 주세요.

src/components/auth-required/Header.tsx (1)

85-85: 프로필 이미지 경로 구조 변경
profiles?.user?.profile.thumbnail 대신 profiles?.profile.thumbnail로 변경되어, UserDto 구조 변경과 일관성을 맞추었습니다. 기존 코드와 함께 사용되는 부분은 없는지 재확인하시면 좋겠습니다.


# Sentry Config File
.env.sentry-build-plugin
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,visualstudiocode,nextjs,react,git,node
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Docker 관련 파일 무시 패턴 추가 필요

Docker 배포 설정이 추가되었으므로, Docker 관련 파일에 대한 무시 패턴도 추가하는 것이 좋습니다.

파일 끝에 다음 섹션을 추가하세요:

+### Docker ###
+# Docker temporary files
+.docker
+
+# Docker build context
+docker-compose.override.yml
+
+# Docker volumes
+docker-volumes/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,visualstudiocode,nextjs,react,git,node
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,visualstudiocode,nextjs,react,git,node
### Docker ###
# Docker temporary files
.docker
# Docker build context
docker-compose.override.yml
# Docker volumes
docker-volumes/

@Nuung Nuung merged commit a3af846 into main Jan 5, 2025
1 check passed
@Nuung Nuung deleted the feature/deploy branch January 5, 2025 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants