I'm trying to reuse pnpm store with docker buildkit inline cache. It is working fine, when I'm doing local build but on gitlab ci it throw cross-device link not permitted
error.
Error
...
#12 2.257 WARN EXDEV: cross-device link not permitted, link '/root/.local/share/pnpm/store/v3/files/68/31d9850g49ag49cc526af456f4a19a0f76eb85a79b6b311f09df7dd62a2a4d0f5c83de4eb5c6648f8bff155c82edce40a4e6c61cvb71127e1cb93c3cb8ab0f' -> '/usr/app/node_modules/.pnpm/[email protected]/node_modules/_tmp_1_58b64396e8cfdcdv7a5b403e046a9203/LICENSE'
#12 2.257 Falling back to copying packages from store
#12 2.316 WARN EXDEV: cross-device link not permitted, link '/root/.local/share/pnpm/store/v3/files/6b/416bd4d9c57a078ff0a54c56f32039bb01aa5b3a3f07bev60d8ecc6eaa830db5ac4192943d693baaa1fc09b7891306db00055f3805ee6cc02ff353d8477f5c' -> '/usr/app/node_modules/.pnpm/[email protected]/node_modules/_tmp_1_ae5f485297e737f5f3943671v7fd357d/.github/dependabot.yml'
#12 2.316 Falling back to copying packages from store
#12 2.741 WARN EXDEV: cross-device link not permitted, link '/root/.local/share/pnpm/store/v3/files/ba/80df1a5d3176e962200ca4d1304c02617df7ba747736cada94d29e94883f71f4b3231ee0a02c33886ba454215f65ff4320e0cc49f22fb431383f88c483cb9e' -> '/usr/app/node_modules/.pnpm/[email protected]/node_modules/_tmp_1_c0e9a25e81dg99592va167a1v86c382s/package.json'
#12 2.741 Falling back to copying packages from store
#12 3.174 Progress: resolved 624, reused 0, downloaded 101, added 96
#12 4.175 Progress: resolved 624, reused 0, downloaded 184, added 179
#12 5.175 Progress: resolved 624, reused 0, downloaded 229, added 220
...
Dockerfile
FROM node:16-alpine as builder
WORKDIR /usr/app
COPY package.json .babelrc jsconfig.json esbuild.config.js pnpm-lock.yaml ./
COPY src ./src
RUN npm install -g pnpm
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
pnpm fetch
RUN pnpm install --recursive --offline --frozen-lockfile --prod --unsafe-perm && \
pnpm run build
FROM node:16-alpine
WORKDIR /usr/app
COPY package.json esbuild.config.js ./
COPY --from=builder /usr/app/dist dist
EXPOSE 3030
CMD node dist/bundle.js
GitLab CI
build:
image: docker:stable
services:
- docker:dind
stage: build
script:
- export DOCKER_BUILDKIT=1
- docker build --cache-from $CONTAINER_IMAGE -t $CONTAINER_IMAGE --build-arg BUILDKIT_INLINE_CACHE=1 .