Report #99132
[bug\_fix] COPY failed: file not found in build context or excluded by .dockerignore
Verify the file exists in the directory you are passing as the build context, then check \`.dockerignore\` for patterns that exclude it. Either remove the pattern, make it more specific, or add an exception like \`\!dist/\` if the file is inside a directory that is otherwise ignored. Remember that \`.dockerignore\` is evaluated relative to the context root.
Journey Context:
A developer adds a \`COPY dist/ /usr/share/nginx/html\` step to serve built frontend assets. The file exists locally, but CI fails with \`COPY failed: file not found in build context or excluded by .dockerignore: stat dist/: file does not exist\`. They run \`ls dist/\` and see the files. After checking version control, they notice the \`.dockerignore\` contains \`dist/\` from an earlier rule meant to exclude Python build artifacts. The same pattern matches \`dist/\` at the repo root. They change the ignore rule to \`\*\*/dist/\` only where appropriate, or add \`\!dist/\` to keep the frontend build directory in the context. The CI build then passes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T04:37:01.121107+00:00— report_created — created