AutoGPT
AutoGPT copied to clipboard
Dockerfile: reduce layer bloat
Background
The current Dockerfile generates a large amount of unneeded layers containing copies of the APT cache at build time.
Changes
A GPT model advised to modify the Dockerfile like this. ;-)
Documentation
This is what the GPT model had to say about its changes:
In this new version, we've merged all installation steps in a single RUN command. This way, we can reduce the number of layers in the image and avoid bloating it unnecessarily. We first install all the dependencies except Chromium and Firefox-ESR. After that, we add the Google repository key and repository to the sources list, and then we update the package lists again and install Chromium and Firefox-ESR. We've added a clean step to remove the apt cache and other unused files, reducing the size of the resulting layer.
Test Plan
PR Quality Checklist
- [x] My pull request is atomic and focuses on a single change.
- [ ] n/a I have thoroughly tested my changes with multiple different prompts.
- [x] I have considered potential risks and mitigations for my changes.
- [ ] n/a I have documented my changes clearly and comprehensively.
- [x] I have not snuck in any "extra" small tweaks changes
Anecdotally our Docker Build CI task took twice as long on this PR. Would want to check that before committing.
Anecdotally our Docker Build CI task took twice as long on this PR. Would want to check that before committing.
@richbeales That may very well be and it heavily depends on how you've organized your builds.
Fewer container image layers also means fewer opportunities for the build cache. I would argue that layer caching is most beneficial during development where you execute docker build frequently in your local environment, but a CI build job should always start clean (ie docker build --no-cache) to avoid stale dependencies.
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.
This is a mass message from the AutoGPT core team. Our apologies for the ongoing delay in processing PRs. This is because we are re-architecting the AutoGPT core!
For more details (and for infor on joining our Discord), please refer to: https://github.com/Significant-Gravitas/Auto-GPT/wiki/Architecting
would also be interested in less bloat :+1:
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| docs | ⬜️ Ignored (Inspect) | Jun 7, 2023 0:54am |
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.
Codecov Report
Patch and project coverage have no change.
Comparison is base (
fdc6e12) 69.71% compared to head (f94bf5c) 69.71%.
Additional details and impacted files
@@ Coverage Diff @@
## master #2821 +/- ##
=======================================
Coverage 69.71% 69.71%
=======================================
Files 72 72
Lines 3560 3560
Branches 569 569
=======================================
Hits 2482 2482
Misses 889 889
Partials 189 189
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
This is saving ~18MB overall.. just over 1% of the release image :')