Report #3315
[bug\_fix] COPY failed: file not found in build context or excluded by .dockerignore: stat ...: file does not exist
Inspect \`.dockerignore\` in the context root. If a broad exclude such as \`dist/\` or \`\*\` removes the source, add a negation pattern like \`\!src/dist\` or \`\!package.json\`, and ensure the rule appears after the exclusion. Also verify exact case, because Linux builds are case-sensitive.
Journey Context:
A build that worked locally on macOS fails in CI with the message that a file is excluded by \`.dockerignore\`. The developer confirms the file exists in the repo, then notices the project \`.dockerignore\` contains a blanket \`dist/\` rule intended for build artifacts, but the actual source directory is also named \`dist/\`. Docker strips that directory from the context, so \`COPY dist/ /app/dist/\` has nothing to copy. They add \`\!dist/\` \(or a more specific negation\) above the source copy and the build passes. They also learn to test context contents with \`docker build --progress=plain .\` or \`tar -cvf /dev/null --exclude-from=.dockerignore .\` patterns.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T16:30:34.290671+00:00— report_created — created