From 41f28926b6cb3a54ae9c188dbf363542d2320224 Mon Sep 17 00:00:00 2001 From: Neha <121790545+Nehabisen21@users.noreply.github.com> Date: Sat, 13 Jan 2024 13:37:50 +0530 Subject: [PATCH] Update Dockerfile --- backend/Dockerfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 90c517dd8..bfb9f8886 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,5 +1,7 @@ +# Stage 1: + # Use the official Node.js 14 image as a base image -FROM node:14 +FROM node:14 AS backend # Set the working directory in the container WORKDIR /usr/src/app @@ -13,5 +15,16 @@ RUN npm install # Copy the rest of the application code to the container COPY . . +# Stage 2: + +# Smaller NodeJS base image +FROM node:14-alpine + +# Set Working Directory for the container +WORKDIR /usr/src/app + +# Copy dependencies from Stage 1 +COPY --from=backend /usr/src/app /usr/src/app + # Specify the command to run when the container starts CMD [ "node", "index.js" ]