@@ -86,10 +86,6 @@ RUN apt update \
8686 # npm otherwise refuses to overwrite with corepack's shims.
8787 && npm install -g --force corepack@latest \
8888 && corepack enable \
89- # Make pnpm >= 11 the version corepack provisions by default: pnpm 10 ignores the
90- # PNPM_CONFIG_* env vars set below, so its store and cache would land in $HOME instead
91- # of /pkg-cache. COREPACK_HOME is passed inline because its ENV is declared further down.
92- && COREPACK_HOME=/pkg-cache/corepack corepack install -g pnpm@latest \
9389 # pnpm 10 ignores the PNPM_CONFIG_* env vars set further down (they are pnpm >= 11 only),
9490 # and npm >= 11 warns on the equivalent npmrc keys / NPM_CONFIG_* vars, so mirror the
9591 # settings into pnpm's own global rc files, which only pnpm reads. This makes Actors that
@@ -101,7 +97,7 @@ RUN apt update \
10197 \
10298 # Pre-create the shared package-manager cache dirs (see the *_CACHE_*/*_STORE_DIR env vars), world-writable so any
10399 # user can populate them and `rm -rf` them at the end to reclaim space, regardless of which user the Actor runs as.
104- && mkdir -p /pkg-cache/npm /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache \
100+ && mkdir -p /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache /pkg-cache/corepack \
105101 && chmod -R 777 /pkg-cache \
106102 \
107103 # Cleanup time
@@ -111,11 +107,8 @@ RUN apt update \
111107 # This is needed to remove an annoying error message when running headful.
112108 && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \
113109 \
114- # Point the default per-user npm cache dirs (~/.npm) at the shared cache, so tooling
115- # that bypasses NPM_CONFIG_CACHE - and templates that `rm -r ~/.npm` - keep working.
116- && rm -rf /root/.npm /home/myuser/.npm \
117- && ln -s /pkg-cache/npm /root/.npm \
118- && ln -s /pkg-cache/npm /home/myuser/.npm
110+ # Clear npm caches populated during setup.
111+ && rm -rf /root/.npm /home/myuser/.npm
119112
120113# Run everything after as non-privileged user.
121114USER myuser
@@ -133,15 +126,12 @@ ENV NODE_ENV=production
133126# so we put back the old limit of 80kb, which seems to work just fine.
134127ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000"
135128
136- # Send every package-manager cache to a single, dedicated location instead of $HOME.
137- # npm, yarn, and pnpm have no real "disable the cache" switch (unlike pip), so isolating
138- # their caches under /pkg-cache is the practical equivalent: the tree holds only throwaway
139- # cache data and can be wiped or mounted as tmpfs without touching installed dependencies.
129+ # Keep yarn and pnpm caches under /pkg-cache so they can be removed after installation.
130+ # npm uses its default ~/.npm directory so existing cache cleanup commands still work.
140131# COREPACK_HOME holds the package-manager versions corepack provisions on demand.
141132# NOTE: only pnpm >= 11 reads the PNPM_CONFIG_* vars; pnpm 10 picks up the same settings
142133# from the global pnpm rc files written to /root/.config/pnpm and /home/myuser/.config/pnpm.
143- ENV NPM_CONFIG_CACHE=/pkg-cache/npm \
144- YARN_CACHE_FOLDER=/pkg-cache/yarn \
134+ ENV YARN_CACHE_FOLDER=/pkg-cache/yarn \
145135 YARN_GLOBAL_FOLDER=/pkg-cache/yarn \
146136 PNPM_CONFIG_STORE_DIR=/pkg-cache/pnpm/store \
147137 PNPM_CONFIG_CACHE_DIR=/pkg-cache/pnpm/cache \
0 commit comments