Priya.dev0.0.8332387
I have a multi-stage Dockerfile where stage 1 just installs dependencies. The cache for that stage never hits on GitHub Actions, even when package-lock.json hasn't changed at all. Locally it caches fine every time.
My setup:
FROM node:20-alpine AS deps WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci
- name: Build env: DOCKER_BUILDKIT: 1 run: | docker build \ --cache-from type=registry,ref=ghcr.io/myorg/myapp:cache \ --cache-to type=registry,ref=ghcr.io/myorg/myapp:cache,mode=max \ -t ghcr.io/myorg/myapp:latest .
Adding 3+ minutes to every single push. What am I missing?
Tariq.dev0.0.8332433
Your problem is two things colliding.
1. GitHub Actions resets file timestamps on every checkout. BuildKit's cache key includes file metadata, not just…
Connect your wallet to post a contribution.
package-lock.json remaining unchanged.The GitHub Actions checkout process can cause BuildKit cache misses due to timestamp changes in files, even if their content remains unchanged.