From 01ee0bea81cb4947fffb8a45c95d52625adf3d9b Mon Sep 17 00:00:00 2001 From: _ <50262751+hunzlahmalik@users.noreply.github.com> Date: Wed, 20 May 2026 18:36:42 +0500 Subject: [PATCH] fix(docker): use --prefer-offline for pnpm install in frontend builds `pnpm install --offline --frozen-lockfile` fails with ERR_PNPM_NO_OFFLINE_TARBALL on cold BuildKit caches (e.g. after `docker builder prune -af`). Root cause: `turbo prune --docker` can drop pnpm catalog entries from the pruned lockfile, so `pnpm fetch` silently skips catalog-resolved packages (e.g. @atlaskit/pragmatic-drag-and-drop@1.7.4). A pre-warmed pnpm-store cache from prior builds masks the gap until it's wiped. --prefer-offline preserves cache locality when warm and falls back to the registry on misses, so first/no-cache builds succeed. Co-Authored-By: Claude Opus 4.7 --- apps/admin/Dockerfile.admin | 2 +- apps/live/Dockerfile.live | 2 +- apps/space/Dockerfile.space | 2 +- apps/web/Dockerfile.web | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/admin/Dockerfile.admin b/apps/admin/Dockerfile.admin index 3ee1d73bf98..7110094347a 100644 --- a/apps/admin/Dockerfile.admin +++ b/apps/admin/Dockerfile.admin @@ -68,7 +68,7 @@ COPY turbo.json turbo.json # Fetch dependencies to cache store, then install offline with dev deps RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store -RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store CI=true pnpm install --offline --frozen-lockfile --store-dir=/pnpm/store --prod=false +RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store CI=true pnpm install --prefer-offline --frozen-lockfile --store-dir=/pnpm/store --prod=false # Build only the admin package RUN pnpm turbo run build --filter=admin diff --git a/apps/live/Dockerfile.live b/apps/live/Dockerfile.live index 864bd0d17e5..3f784ef5608 100644 --- a/apps/live/Dockerfile.live +++ b/apps/live/Dockerfile.live @@ -41,7 +41,7 @@ COPY turbo.json turbo.json # Fetch dependencies to cache store, then install offline with dev deps RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store -RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store CI=true pnpm install --offline --frozen-lockfile --store-dir=/pnpm/store +RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store CI=true pnpm install --prefer-offline --frozen-lockfile --store-dir=/pnpm/store ENV TURBO_TELEMETRY_DISABLED=1 diff --git a/apps/space/Dockerfile.space b/apps/space/Dockerfile.space index 39a05176aeb..879668e2918 100644 --- a/apps/space/Dockerfile.space +++ b/apps/space/Dockerfile.space @@ -69,7 +69,7 @@ COPY turbo.json turbo.json # Fetch dependencies to cache store, then install offline with dev deps RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store -RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store CI=true pnpm install --offline --frozen-lockfile --store-dir=/pnpm/store --prod=false +RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store CI=true pnpm install --prefer-offline --frozen-lockfile --store-dir=/pnpm/store --prod=false # Build only the space package RUN pnpm turbo run build --filter=space diff --git a/apps/web/Dockerfile.web b/apps/web/Dockerfile.web index 4a40054ae58..244967f95f5 100644 --- a/apps/web/Dockerfile.web +++ b/apps/web/Dockerfile.web @@ -41,7 +41,7 @@ COPY turbo.json turbo.json # Fetch dependencies to cache store, then install offline with dev deps RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store -RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store CI=true pnpm install --offline --frozen-lockfile --store-dir=/pnpm/store +RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store CI=true pnpm install --prefer-offline --frozen-lockfile --store-dir=/pnpm/store ARG VITE_API_BASE_URL="" ENV VITE_API_BASE_URL=$VITE_API_BASE_URL