Skip to content

Commit

Permalink
docs: fix pnpm install code 3
Browse files Browse the repository at this point in the history
  • Loading branch information
wuzoo committed Jan 18, 2025
1 parent 6ca42ad commit 2743020
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions Dockerfile.client
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
# Stage 1
# Stage 1: Build stage
FROM node:21-alpine AS build

# 필요한 환경 변수 설정
ENV NODE_ENV production
ENV PNPM_HOME /pnpm
ENV PATH $PNPM_HOME:$PATH
RUN corepack enable
# pnpm 설치
# 환경 변수 설정
ENV NODE_ENV=production

# corepack으로 pnpm 활성화 및 버전 고정
RUN corepack enable && corepack prepare [email protected] --activate

WORKDIR /app

# package.json과 pnpm-lock.yaml만 복사하여 의존성 설치
COPY package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm build:client
RUN --mount=type=cache,target=/root/.pnpm-store pnpm install --frozen-lockfile

# 나머지 프로젝트 파일 복사 및 빌드
COPY . ./
RUN pnpm build:client

# Stage 2
# Stage 2: Serve stage
FROM nginx:stable-alpine

# 빌드 결과 복사
COPY --from=build /app/dist /usr/share/nginx/html

# Nginx 설정 복사
RUN rm /etc/nginx/conf.d/default.conf
COPY /nginx/client.conf /etc/nginx/conf.d

# 포트 노출
EXPOSE 443 80

# Nginx 실행
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 2743020

Please sign in to comment.