You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the docs there is supposed to be an offline workflow where corepack doesn't need internet:
Or you're publishing your project to a system where the network is unavailable, in which case you'll preemptively generate a package manager archive from your local computer (using corepack pack -o) before storing it somewhere your container will be able to access (for example within your repository). After that it'll just be a matter of running corepack install -g --cache-only <path/to/corepack.tgz> to setup the cache.
FROM node:20-slim AS build
WORKDIR /app
ENV PNPM_HOME="/pnpm"ENV PATH="$PNPM_HOME:$PATH"COPY . .
RUN --mount=type=cache,id=corepack,target=/app/cache \
ls -la /app/cache
RUN --mount=type=cache,id=corepack,target=/app/cache \
if [ ! -f "/app/cache/corepack.tgz" ]; then \
corepack pnpm --version; \
mkdir -p /app/cache; \
corepack pack -o /app/cache/corepack.tgz; \
fi
RUN --mount=type=cache,id=corepack,target=/app/cache \
COREPACK_ENABLE_NETWORK=0 corepack install -g --cache-only /app/cache/corepack.tgz
#RUN COREPACK_ENABLE_STRICT=0 COREPACK_ENABLE_NETWORK=0 corepack pnpm --versionRUN \
--mount=type=cache,id=pnpm,target=/pnpm/store \
COREPACK_ENABLE_STRICT=0 COREPACK_ENABLE_NETWORK=0 corepack pnpm install --frozen-lockfile --prefer-offline
EXPOSE 80
CMD ["node", "./src/index.js"]
The Dockerfile is supposed to download pnpm using corepack and then cache it using corepack pack.
Then it tries to install it from the cache
At last I try to run a pnpm command through corepack with COREPACK_ENABLE_NETWORK=0 to simulate no internet. This does not work. Neither corepack pnpm install nor corepack pnpm --version.
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
:The text was updated successfully, but these errors were encountered: