Skip to content

Commit

Permalink
[test] docker image 경량화
Browse files Browse the repository at this point in the history
  • Loading branch information
edder773 committed Nov 25, 2024
1 parent e833ce6 commit 5972871
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,26 @@ WORKDIR /app

# 공통 package.json과 lock 파일을 복사 및 설치
COPY package*.json pnpm-lock.yaml ./
RUN pnpm install --no-dev
RUN pnpm install

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

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

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

# 작업 디렉토리 설정
# 작업 디렉토리 설정 및 복사
WORKDIR /app

# 빌드 스테이지에서 필요한 파일만 복사
COPY --from=builder /app/apps/frontend/dist /app/apps/frontend/dist
COPY --from=builder /app/apps/backend/dist /app/apps/backend/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/pnpm-lock.yaml /app/pnpm-lock.yaml
RUN npm install -g pnpm
COPY --from=builder /app /app

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

0 comments on commit 5972871

Please sign in to comment.