From 444a4bbbfba52f3a913f84ea87981f7e966ffb8a Mon Sep 17 00:00:00 2001 From: sayyyho <323psh@naver.com> Date: Fri, 30 Aug 2024 03:09:41 +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 | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index f427546..a2440e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Base image -FROM node:18-alpine as build +# Base image with the latest Node.js version +FROM node:latest as build # Set working directory WORKDIR /app @@ -8,25 +8,22 @@ WORKDIR /app COPY package.json package-lock.json ./ RUN npm install -# Copy all files +# Copy the rest of the application files COPY . . -# Build the application +# Build the application (if needed) RUN npm run build -# Production image +# Use Nginx for production FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html -# Node.js 설치 및 의존성 설치 -RUN apk add --no-cache nodejs npm -COPY . /app -RUN npm install --production - +# Remove default Nginx configuration and add custom configuration RUN rm /etc/nginx/conf.d/default.conf -COPY ./nginx.conf /etc/nginx/conf.d +COPY ./nginx.conf /etc/nginx/conf.d/ -# Expose ports for Nginx and Node.js +# Expose ports EXPOSE 80 3000 -CMD ["sh", "-c", "node /app/server.cjs & nginx -g 'daemon off;'"] \ No newline at end of file +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file