Open TheKnarf opened 3 months ago
Seems like my mistake was using --cache-only
as that didn't activate pnpm
.
Now that seems this seems to work:
RUN --mount=type=cache,target=/app/cache \
COREPACK_ENABLE_NETWORK=0 corepack install -g /app/cache/corepack.tgz
Perhaps adding an example to the Readme would help others in the future?
According to the docs there is supposed to be an offline workflow where
corepack
doesn't need internet:I've created an example project to reproduce the bug with the following Dockerfile:
The Dockerfile is supposed to download
pnpm
using corepack and then cache it usingcorepack pack
.Then it tries to install it from the cache
At last I try to run a
pnpm
command throughcorepack
withCOREPACK_ENABLE_NETWORK=0
to simulate no internet. This does not work. Neithercorepack pnpm install
norcorepack pnpm --version
.Error log
docker build -f ./Dockerfile -t corepack-offline-bug . --progress plain
: