From c4abbe13fb4a272d6e4c397de514c3216fb005f1 Mon Sep 17 00:00:00 2001 From: SayuShira <104025906+SayuShira@users.noreply.github.com> Date: Tue, 24 Oct 2023 15:55:13 +0200 Subject: [PATCH] Remove npm update, pin pnpm version + use the one from package.json for the project --- Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 189b3dd..0d42d5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,22 @@ FROM node:lts-alpine AS base -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable WORKDIR /app -RUN npm install -g npm@latest -RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh - FROM base AS deps + +# This PNPM_VERSION is used to install the dependencies. Those include a possibly different version of pnpm +# that is to be used for the package. Found in package.json - packageManager +ENV PNPM_VERSION=8.6.2 + +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh - + COPY . /app RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile + FROM base COPY --from=deps /app/node_modules /app/node_modules