From 62258b1f7425d84ca1a10d606d139d193a474e68 Mon Sep 17 00:00:00 2001 From: leejisun9 Date: Wed, 27 Aug 2025 16:02:05 +0900 Subject: [PATCH] =?UTF-8?q?docker=20=EB=B9=8C=EB=93=9C=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index a3a6308..29f8706 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,18 @@ -# nodejs-18-alpine 이미지를 기반으로 사용 (가볍고 효율적) -FROM node:20-alpine - -# 컨테이너의 작업 디렉터리를 설정 +# --- build stage --- +FROM node:20-alpine AS build WORKDIR /app - -# package.json과 package-lock.json을 복사 COPY package*.json ./ - -# 의존성 설치 -RUN npm install - -# 모든 소스 파일을 컨테이너로 복사 +RUN npm ci COPY . . +# 환경에 맞게: npm run build or nuxi build +RUN npm run build -# 개발 환경 실행 명령 (이 명령은 docker-compose.yml에서 덮어쓸 것임) -CMD ["npm", "run", "dev"] \ No newline at end of file +# --- run stage --- +FROM node:20-alpine +WORKDIR /app +ENV NODE_ENV=production +ENV PORT=3000 +# Nitro 출력만 복사 +COPY --from=build /app/.output ./.output +EXPOSE 3000 +CMD ["node", ".output/server/index.mjs"] \ No newline at end of file