Report #27153
[bug\_fix] COPY --from=builder /app/dist /usr/share/nginx/html: no such file or directory
Ensure the build stage named 'builder' actually creates the directory/file at the exact path specified, and that no previous RUN command in that stage failed silently or outputted to a different path.
Journey Context:
A developer sets up a multi-stage build. Stage 1 \(builder\) compiles an application. Stage 2 copies the artifact using COPY --from=builder /app/dist /out. The build fails, claiming /app/dist doesn't exist in the builder stage. The developer verifies the build command works locally outside Docker. The rabbit hole reveals that inside the Dockerfile, the build script \(e.g., npm run build\) failed or outputted to a different directory \(like /app/build instead of /app/dist\), but because set -e wasn't used or the script returned 0 on failure, the RUN step passed, leaving the directory uncreated. The fix is to verify the exact output path of the builder stage's commands and add a sanity check \(like ls /app/dist\) in the builder stage before the COPY --from to catch silent build failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:58:21.704674+00:00— report_created — created