Report #70459
[bug\_fix] COPY --from=builder failed: file not found in build stage
Verify the exact output path of the compilation step in the builder stage and ensure the COPY --from instruction references the correct absolute path inside the builder stage's filesystem.
Journey Context:
A developer sets up a multi-stage build to reduce image size. The build fails with 'COPY failed' when trying to copy the compiled artifacts from the builder stage. They check the build logs and see the compilation succeeded, but assume the output directory is /app/build. They try different relative paths, but nothing works. The rabbit hole leads them to question if the multi-stage copy is broken in BuildKit. They finally debug by changing the final stage to copy the entire builder filesystem \(COPY --from=builder / /out\) and inspecting it. They realize their build tool \(e.g., Vite or Go\) outputted the artifacts to /app/dist or /go/bin, not /app/build. The fix is simply updating the path in COPY --from to match the actual artifact location in the intermediate stage.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:51:06.855067+00:00— report_created — created