From 05437fb7e49769df7633607da465cc31dc134f40 Mon Sep 17 00:00:00 2001 From: Eduard Marbach Date: Mon, 7 Oct 2024 12:54:48 +0200 Subject: [PATCH] opt: try adding support for custom UID/GID executions --- Dockerfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index dd2421b..f88fcc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,24 @@ # https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md FROM node:22.9.0-slim AS base -ENV PNPM_HOME="/pnpm" +ENV PNPM_HOME="/opt/pnpm" +ENV COREPACK_HOME="/opt/corepack" ENV PATH="$PNPM_HOME:$PATH" RUN apt-get update && apt-get install -y \ git \ - && rm -rf /var/lib/apt/lists/* \ - && corepack enable \ - && corepack prepare pnpm@9 --activate + && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY package.json pnpm-lock.yaml /app/ +# Do it here to add the packageManager field to the package.json +RUN corepack enable \ + && corepack prepare pnpm@9 --activate \ + && corepack use pnpm@9 + FROM base AS prod-deps RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile FROM base -RUN corepack use pnpm@9 COPY --from=prod-deps /app/node_modules /app/node_modules COPY index.ts /app/ COPY src/ /app/src/ @@ -23,6 +26,8 @@ COPY src/ /app/src/ ENV CONFIG_LOCATION=/app/config/config.yml ENV SECRETS_LOCATION=/app/config/secrets.yml +RUN chmod uga+rw -R /app/package.json + #USER node CMD [ "pnpm", "start" ]