From 7ace1373f0f00e81a446da4ba7359d356310cebd Mon Sep 17 00:00:00 2001 From: Saransh Balyan <57568571+saranshbalyan-1234@users.noreply.github.com> Date: Thu, 19 Sep 2024 01:56:47 +0530 Subject: [PATCH] Update Dockerfile --- Dockerfile | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3c8a5a1..97245fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,13 @@ -FROM node:20 - -# Create app directory -WORKDIR /usr/src/app - -ENV PORT 8080 +FROM node:20 AS build-env +COPY . /app +WORKDIR /app ENV NODE_ENV production - -# Install app dependencies -COPY /package*.json ./ RUN npm ci -# RUN npm install pm2 -g - -# Bundle app source -COPY . ./ +FROM gcr.io/distroless/nodejs20-debian12 +COPY --from=build-env /app /app +WORKDIR /app +ENV PORT 8080 +ENV NODE_ENV production EXPOSE 8080 - -#scaling -# CMD ["pm2-runtime", "index.js", "-i","-0"] -CMD [ "npm","start" ] \ No newline at end of file +CMD ["index.js"] \ No newline at end of file