Repository navigation
fix: keep local files out of example images - #513
Merged
Merged
Conversation
The example Dockerfiles copy their whole directory, and their .dockerignore files listed only /data (and /chart), so local .env files or config overlays ended up in the images. The .dockerignore files are now allowlists of the files each app needs, and the getting started guide recommends the same for apps. Closes #511 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR prevents local Flow diagram for allowlisted Docker build contextsflowchart LR
Context[Docker build context]
Ignore[.dockerignore allowlist]
Image[Example image]
Local[Local .env and config overlays]
App[Required application files]
Context --> Ignore
Local --> Context
App --> Context
Ignore -->|exclude| Local
Ignore -->|include| App
App --> Image
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #513 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 55 55
Lines 6558 6558
=========================================
Hits 6558 6558
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
marked this pull request as ready for review
October 26, 2026 11:13
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The example Dockerfiles copy their whole directory (
COPY ./ /app), but their.dockerignorefiles only listed/data(and/chart). So a local.envfile or config overlay ended up in the image.examples/petstore/.dockerignoreandexamples/petstore-access-control/.dockerignoreare now allowlists:*, then only the files each app needs (app.py,config.yaml, controllers, exceptions, spec, and for petstore alsowsgi.pyandworker.py; the policy model for the access control example)..dockerignorefiles for apps that copy their build context.Light lane: the change touches only configuration files of the examples and docs. I reviewed the diff myself.
Closes #511
Verification
.envfile present (FROM busybox,COPY . /c,find /c). Only the allowlisted files were copied: 7 for petstore, 6 for petstore with access control. No.env*file was copied.mkdocs build --strict: pass.pre-commit: pass.🤖 Generated with Claude Code
Summary by Sourcery
Restrict example Docker build contexts to required application files and document the recommended
.dockerignorepattern.Bug Fixes:
Enhancements:
.dockerignoreusage for applications that copy their entire Docker build context.Documentation: