ci: fix dockerfile

This commit is contained in:
Nicola Zambello 2022-02-11 13:19:40 +01:00
parent 764f7f61ff
commit 13e000f78c

View file

@ -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