-
Notifications
You must be signed in to change notification settings - Fork 101
Optimize Docker images with multi-stage builds #888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Co-authored-by: fengmk2 <[email protected]>
Co-authored-by: fengmk2 <[email protected]>
Co-authored-by: fengmk2 <[email protected]>
Co-authored-by: fengmk2 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #888 +/- ##
========================================
Coverage 95.19% 95.19%
========================================
Files 197 197
Lines 23948 23948
Branches 2496 2314 -182
========================================
Hits 22797 22797
Misses 1151 1151 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Reduces Docker image size by 30-50% using multi-stage builds and production-only dependencies, based on Docker image optimization best practices.
Changes
Dockerfiles (.docker/alpine/Dockerfile, .docker/debian/Dockerfile)
package.json→ install → copy source (improves build cache hit rate)npm ci --only=productionin final stage, exclude ~50-100MB of devDependencies.dockerignore
Expand exclusions from 7 to 30+ patterns: development files, documentation, tests, CI/CD configs, IDE settings
Structure
Size Reduction Breakdown
Documentation
DOCKER_OPTIMIZATION.md: Detailed optimization rationale and comparison.docker/README.md: Build and test instructionsdocs/deploy-in-docker.md: Added optimization referenceBackward Compatibility
No breaking changes. Environment variables, ports, and startup behavior unchanged. Existing deployment scripts remain compatible.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.