From 230d523891d210c4bd831026466033ed10878ddd Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Wed, 27 May 2026 23:31:32 +0200 Subject: [PATCH] chore(docker): cache pnpm store to avoid re-downloading deps Source is copied before install because the root postinstall (nuxt prepare) needs it, so the dependency layer can't be cached by ordering alone. A BuildKit cache mount on pnpm's store keeps packages across builds instead. --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 182e785..d038b7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,11 @@ FROM node:24-alpine AS build RUN corepack enable WORKDIR /app COPY . . -RUN pnpm install --frozen-lockfile +# Cache the pnpm store across builds so dependencies aren't re-downloaded on +# every source change. Source is copied first because the root `postinstall` +# (nuxt prepare) needs it. +RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \ + pnpm install --frozen-lockfile RUN pnpm build # --- Runtime stage: minimal image running the built server ---