Report #43759
[bug\_fix] COPY --from=builder /app/build /usr/share/nginx/html fails with 'file not found' even though the builder stage completes successfully
Ensure the absolute path in the COPY --from command exactly matches the output directory of the build tool in the previous stage \(e.g., change /app/build to /app/dist\). Add an ls command in the builder stage to verify the output location.
Journey Context:
A developer sets up a multi-stage build to compile a React application and serve it via Nginx. The first stage \(named builder\) runs npm run build and exits successfully. The second stage attempts COPY --from=builder /app/build /usr/share/nginx/html but fails. The developer is confused because the build step didn't error out. They spend hours tweaking npm configurations, thinking the build is failing silently. The breakthrough comes when they add RUN ls -la /app to the builder stage. They discover that the specific React boilerplate they are using outputs to /app/dist, not /app/build. The COPY command was looking in the wrong directory. Updating the path to /app/dist resolves the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T03:55:16.952197+00:00— report_created — created