Skip to content

Commit

Permalink
[refactor] docker 이미지 크기 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
edder773 committed Nov 25, 2024
1 parent a947ae4 commit cc8f328
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .Dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist
*.log
.git
.github
.gitignore
Dockerfile
build/
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Node.js 20 이미지 설정
FROM node:20
# 1단계: 빌드 스테이지 (멀티 스테이지 빌드)
FROM node:20-alpine AS builder

# pnpm 설치
RUN npm install -g pnpm
Expand All @@ -13,15 +13,23 @@ RUN pnpm install

# 프론트엔드 파일 복사 및 빌드
WORKDIR /app/apps/frontend
COPY apps/frontend ./
COPY apps/frontend ./
RUN pnpm install
RUN pnpm run build

# 백엔드 파일 복사 및 의존성 설치
WORKDIR /app/apps/backend
COPY apps/backend ./
COPY apps/backend ./
RUN pnpm install

# 2단계: 실행 이미지
FROM node:20-alpine

# 작업 디렉토리 설정 및 복사
WORKDIR /app
RUN npm install -g pnpm
COPY --from=builder /app /app

# 프론트엔드와 백엔드 포트 노출 설정
EXPOSE 3000 8080

Expand Down

0 comments on commit cc8f328

Please sign in to comment.