Report #90011
[bug\_fix] ERROR: failed to solve: failed to compute cache key: /app/dist not found: not found when using COPY --from=builder.
Ensure the build tool in the builder stage actually outputs to the expected directory, and verify the path in \`COPY --from=builder /expected/path /dest/path\` matches the builder's filesystem exactly.
Journey Context:
A developer sets up a multi-stage build. The first stage runs \`npm run build\` which compiles TypeScript to JavaScript. The second stage attempts \`COPY --from=builder /app/src ./src\` instead of \`/app/dist\`. The build fails. They stare at the error, confused because \`npm run build\` didn't fail in the first stage. They add a \`RUN ls -la\` to the builder stage to debug, but the error persists. They realize the build tool \(e.g., Vite, tsc\) was configured to output to a \`dist/\` folder, but they assumed it output to \`src/\` or \`build/\`. Because the \`COPY --from\` command is evaluated by BuildKit to compute the cache key before the stage fully executes, if the path doesn't exist in the previous stage's snapshot, it fails immediately. Updating the \`COPY\` path to match the actual build output directory resolves the error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:40:39.430836+00:00— report_created — created