diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 29708b7bb..8af0edb8a 100644 --- a/frontend/Dockerfile +++ b/frontend/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 frontend # 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=frontend /usr/src/app /usr/src/app + # Specify the command to run when the container starts CMD [ "npm", "start" ]