From 83d3e4f1509a3f5f4dcc9eccd8aa7b1394526b3f Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sun, 23 Oct 2022 17:51:33 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Dockerfile=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index a250626..21315d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,24 @@ FROM node:19 AS builder -WORKDIR /usr - -COPY tsconfig.json ./ - -COPY src ./src +# Create app directory +WORKDIR /app +# A wildcard is used to ensure both package.json AND package-lock.json are copied COPY package*.json ./ - COPY prisma ./prisma/ -RUN ls -a - +# Install app dependencies RUN npm install +COPY . . + RUN npm run build -## this is stage two , where the app actually runs - FROM node:19 -WORKDIR /usr +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package*.json ./ +COPY --from=builder /app/dist ./dist - -COPY --from=builder /usr/package*.json ./ - -COPY --from=builder /usr/dist ./dist - -RUN npm install --omit=dev - -CMD ["node","dist/index.js"] \ No newline at end of file +EXPOSE 3000 +CMD [ "npm", "run", "start:prod" ]