Symptom
Local and CI unit tests all green (the file exists in the repo), but only in the deployed build: 404 / 400 / file not found. Same type, three recurrences.
Cause pattern
A route reads a relative path (Path("data/x.json")) and that file isn't in the image. Two root causes, sometimes both:
.dockerignore excludes the whole directory, so it is gone before the build context even formsFix
! re-include in .dockerignoretest -f /app/data/*.json and fail the job if it's missingHabit
Whenever you add or move a path the runtime reads, three-way check: (1) Dockerfile COPY (2) .dockerignore exclusions (3) the route's relative path vs WORKDIR
Verification trick (when you can't pull the base image)
.dockerignore has nothing to do with the base image. Build the same COPY lines FROM scratch and context inclusion is verified as-is: if excluded, it fails with "not found in build context."
Inspecting a shell-less scratch image directly
FROM scratch has no shell, so docker run … ls is not an option. Extract without running: docker create <img> /x → docker cp <cid>:/app/data ./out → ls -la ./out, then compare sha256 against the source in the repo. Same bytes or it didn't land.