-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
10 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 |
---|---|---|
@@ -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;"] |