Report #55317
[bug\_fix] COPY --from=0 or COPY --from=builder fails with 'file not found' in multi-stage build
Ensure the path in the COPY --from instruction exactly matches the absolute path where the artifact was created in the previous stage. Verify the build tool's actual output directory.
Journey Context:
A developer creates a multi-stage build. The first stage compiles a React app using 'npm run build'. The second stage uses Nginx and tries to 'COPY --from=builder /app/build /usr/share/nginx/html'. The build fails, claiming '/app/build' doesn't exist. The developer is confused because the logs show the build succeeded. They add a 'RUN ls -la /app' to the builder stage and see the output is actually in '/app/dist' because the bundler \(Vite/Webpack\) was configured to output to 'dist', not 'build'. They update the COPY instruction to 'COPY --from=builder /app/dist /usr/share/nginx/html'. The fix works because COPY --from operates on the filesystem snapshot of the previous stage, and if the path doesn't match the actual output directory, it strictly fails.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:20:25.639564+00:00— report_created — created