From 998aaf657a45709d5b66c23a9b57ee9d779c3dc0 Mon Sep 17 00:00:00 2001 From: sayyyho <323psh@naver.com> Date: Fri, 30 Aug 2024 03:05:59 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EB=8F=84=EC=BB=A4=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=82=B4=20node=20=EC=8B=A4=ED=96=89=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 830c397..f427546 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# Base image with Node.js +# Base image FROM node:18-alpine as build # Set working directory @@ -14,20 +14,19 @@ COPY . . # Build the application RUN npm run build -# Production image for Nginx +# Production image FROM nginx:alpine - -# Make sure the app directory is created in this stage -WORKDIR /app - COPY --from=build /app/dist /usr/share/nginx/html -COPY --from=build /app/server.cjs /app + +# Node.js 설치 및 의존성 설치 +RUN apk add --no-cache nodejs npm +COPY . /app +RUN npm install --production RUN rm /etc/nginx/conf.d/default.conf COPY ./nginx.conf /etc/nginx/conf.d -# Expose ports +# Expose ports for Nginx and Node.js EXPOSE 80 3000 -# Start Nginx and Node.js server CMD ["sh", "-c", "node /app/server.cjs & nginx -g 'daemon off;'"] \ No newline at end of file