From e0a4938a78fb79515ad45b7885f249453161cf30 Mon Sep 17 00:00:00 2001 From: claude Date: Tue, 2 Jun 2026 15:15:38 +0000 Subject: [PATCH] CI: make Yarn Classic fallback cache a tmpfs (fresh per build) #74 corrupted the persistent fallback cache again despite serialising the fetch, so the cause isn't a write race: BuildKit evicts part of that persistent cache mount between builds (the first build after each id bump always passed, later ones failed). Mount /usr/local/share/.cache/yarn as tmpfs so it's clean every build and nothing can be half-evicted; the Berry cache stays persistent. Co-Authored-By: Claude Opus 4.8 --- server-ce/Dockerfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 91255ba280..21bc965087 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -25,14 +25,18 @@ ENV COREPACK_ENABLE_NETWORK=0 # Install yarn dependencies # ------------------------- -# YARN_NETWORK_CONCURRENCY=1 serialises Yarn's fetch step. The git-sourced -# @replit/codemirror-* deps are prepared with Yarn Classic, which pulls *all* -# esbuild platform binaries into the one shared /usr/local/share/.cache/yarn -# folder; preparing several of them in parallel races and corrupts that cache -# (EEXIST / missing .yarn-tarball.tgz). Serialising the fetch removes the race. +# The git-sourced @replit/codemirror-* deps are prepared with Yarn Classic, +# whose cache lives in /usr/local/share/.cache/yarn. We mount that as a *tmpfs* +# (fresh every build) rather than a persistent BuildKit cache: when it was +# persistent, BuildKit would garbage-collect/evict part of it between builds, +# leaving a half-populated cache that Yarn Classic then tripped over (missing +# .yarn-tarball.tgz / EEXIST). A clean cache per build is reliable; the cost is +# re-fetching that small set of git deps. The valuable Berry cache +# (server-ce-yarn-cache) stays persistent. YARN_NETWORK_CONCURRENCY=1 is kept +# as cheap insurance against concurrent writes to the fresh cache. RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/root/.yarn/berry/cache,id=server-ce-yarn-cache \ - --mount=type=cache,target=/usr/local/share/.cache/yarn,id=server-ce-yarn-fallback-cache-v3 \ + --mount=type=tmpfs,target=/usr/local/share/.cache/yarn \ --mount=type=tmpfs,target=/tmp node genScript install | YARN_NETWORK_CONCURRENCY=1 bash # Add the actual source files @@ -40,7 +44,7 @@ RUN --mount=type=cache,target=/root/.cache \ COPY --parents libraries/ services/ tools/migrations/ /overleaf/ RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/root/.yarn/berry/cache,id=server-ce-yarn-cache \ - --mount=type=cache,target=/usr/local/share/.cache/yarn,id=server-ce-yarn-fallback-cache-v3 \ + --mount=type=tmpfs,target=/usr/local/share/.cache/yarn \ --mount=type=cache,target=/overleaf/services/web/node_modules/.cache,id=server-ce-webpack-cache \ --mount=type=tmpfs,target=/tmp \ node genScript compile | YARN_NETWORK_CONCURRENCY=1 bash || \