From 13e000f78c01bd0f64376a96a3f1e2ad1e6e9a81 Mon Sep 17 00:00:00 2001 From: nzambello Date: Fri, 11 Feb 2022 13:19:40 +0100 Subject: [PATCH] ci: fix dockerfile --- Dockerfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4f80c50..4474d0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,17 +4,14 @@ FROM node:16-bullseye-slim as base # Install openssl for Prisma RUN apt-get update && apt-get install -y openssl -# set for base and all that inherit from it -ENV NODE_ENV=production - # Install all node_modules, including dev dependencies FROM base as deps RUN mkdir /app WORKDIR /app -ADD package.json yarn.lock ./ -RUN yarn install +ADD package.json ./ +RUN npm install --production=false # Setup production node_modules FROM base as production-deps @@ -23,8 +20,8 @@ RUN mkdir /app WORKDIR /app COPY --from=deps /app/node_modules /app/node_modules -ADD package.json yarn.lock ./ -RUN yarn install +ADD package.json ./ +RUN npm prune --production # Build the app FROM base as build @@ -34,11 +31,13 @@ WORKDIR /app COPY --from=deps /app/node_modules /app/node_modules +ENV NODE_ENV=production + ADD prisma . RUN npx prisma generate ADD . . -RUN yarn build +RUN npm run build # Finally, build the production image with minimal footprint FROM base