Docker COPY --from path not found in a multi-stage build in CI
The named stage is valid, but the path you copy from it does not exist. BuildKit reports "failed to compute cache key: ... not found" because the artifact was never built, or it lives at a different path than the COPY expects.
What this error means
A COPY --from=builder /app/dist /out step fails with "failed to compute cache key: ... not found" (classic builder prints "COPY failed: stat ...: no such file or directory"). The stage name itself resolves fine.
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum
of ref ...: "/app/dist": not foundCommon causes
The artifact was never produced in that stage
The build step in the named stage did not create the expected output, so the path the COPY references is absent.
The path differs from the COPY source
A different WORKDIR or output filename in the builder stage means the file exists, but not at the path you copy from.
How to fix it
Verify the path inside the source stage
- Add a temporary
RUN ls -la <dir>in the builder stage to print what it produced. - Match the COPY source to the real output path and filename.
- Confirm the build step that creates the artifact actually ran.
Align WORKDIR and output paths
Use an absolute, explicit output path in the builder and copy from exactly that path.
FROM node:20 AS builder
WORKDIR /app
RUN npm run build # outputs to /app/dist
FROM nginx
COPY --from=builder /app/dist /usr/share/nginx/htmlHow to prevent it
- Use absolute output paths in builder stages.
- Confirm the artifact is produced before copying it.
- Keep COPY --from sources aligned with the builder WORKDIR.