Add dockerignore to clean up final image#384
Add dockerignore to clean up final image#384lpmi-13 wants to merge 4 commits intoRaspberryPiFoundation:mainfrom
Conversation
Currently, the final base image has a bunch of things it doesn't need, including the entire .git folder. This commit adds a .dockerignore to keep the things we don't need out of the final image.
|
We require contributors to sign our Contributor License Agreement, and we don't have you on file. In order for us to review and merge your code, please complete this form and we'll get you added and review your contribution as soon as possible. |
|
tried to submit the CLA form twice, but maybe it just takes a while to sync 🤷 |
|
This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
I'm investigating this issue. Not stale |
Reorganise and expand .dockerignore entries to exclude CI, Docker config, editor/devtooling files, docs, environment samples, tests, and runtime directories. Reduces Docker build context size and prevents including unnecessary or sensitive files (e.g. .env.example, log, tmp, storage, .devcontainer, Dockerfile, docker-compose files, .DS_Store, rubocop config, docs, spec)
There was a problem hiding this comment.
Pull request overview
This PR adds a .dockerignore file to reduce the size of the Docker image by excluding unnecessary files from the build context. The application is a Rails application that uses a multi-stage Docker build, and this change ensures that development files, version control data, and other non-runtime assets are excluded from the final image.
Changes:
- Added comprehensive
.dockerignorefile that excludes version control files (.git), CI/CD configuration, development tooling, tests, and documentation while preserving all runtime-required files
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The Dockerfile copies .tool-versions during the builder stage, so excluding it in .dockerignore causes the image build to fail with a missing file error. This keeps the ignore list lean while preserving a successful app image build. Made-with: Cursor
Points for consideration:
Currently, the final base image has a bunch of things it doesn't need, including the entire .git folder.
This commit adds a .dockerignore to keep the things we don't need out of the final image.
What's changed?