-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Docker image is huge #946
Comments
Coming back to this issue (my system regularly complains this is taking too much disk space! 😱). Actually I wonder if dividing the docker image wouldn't be even cleaner:
The only downside is that running all managers updaters will not be possible in the same container. (Is this a real downside? Are you used to run multiple manager-type updaters in the same container?) If interested, I can make PRs to iterate over this idea. |
I know @hmarr has some plans for this - can you share? |
@LeoColomb yes, we're planning exactly that! This is actually one of the main motivations for splitting up each language / package manager into independent top-level gems in dependabot-core. Once that big refactor is finished (we're super close), the next stage is to produce much leaner Docker images for each package manager, and use multi-stage builds to further trim the unnecessary fat. If we use multi-stage builds to set up each of the native helpers, it should also be pretty trivial to re-combine them all into one big image, which would be a nice feature for people running this from home / their own servers. |
If you're up for helping out, that'd be awesome 🙌. I'll ping you once we're ready to start splitting up the Dockerfiles. |
Cool! Sure, I'm up for this! 🎉 👍 |
Lines 73 to 80 in 75b5c17
If can move the base image to Alpine or Debian, we might be able to replace this with the node image |
@LeoColomb have you already started on the recommendations mentioned in #946 (comment)? If not I'd be happy to try it |
@rajivshah3 Yes, I have, but the last two tasks in the checklist are very difficult to implement:
That's why splitting seems much more relevant, on the one hand because using official languages docker images will be easier, on the other hand required languages will be isolated and won't pollute other Dependabot images, all of this keeping the same base for runs which can helps the cache for the docker images. |
Also as there is currently the Docker refactoring going on in #986:
It is considered as a best practice and a general recommendation to make any attack surface smaller. |
@alexanderadam +1 on that. We use an unprivileged user internally (we just use the dependabot-core image as a base image), but I'd also like the base image to start out with the non-root user wherever possible. |
Has anyone considered using Nix to create a reproducible development/build environment which also happens to be much lighter (and runs on the metal on Macs too)? I'd be up to create a PR that sets up the environment to support all languages supported by dependabot-core (and would probably get set up in less time than Docker without the need to set up tens of volumes). FWIW, Nix has been around since 2005 and has several hundreds of PRs merged every month, so the community can be said to be quite active. Let me know if this would be interesting or if you have any questions. |
Hi @pombeirp! I'm a big fan of Nix's approach. That said, we aren't able to support a migration to Nix right now. It'd represent a fairly large change to our build process, and we don't the capacity to make that change on our side given all the other things we have on our plate, and I'd rather not have two separate build processes in this project. Additionally, while in some ways inferior, Docker is a much more widely used project and therefore more accessible to wider audience. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Any news? The issue looks like abandoned :( |
Some work is being done here to improve some of the layers, but the actual solution here would be to split up the images per ecosystem. We've been wanting to do that for a long time, but unsure when we'll be able to prioritize it. |
I'm happy to report that my recent work in #5024 to refactor our build automation with Earthly should allow us to easily split up our Docker image by ecosystem. For example, in this commit adds a Comparing the uncompressed sizes of each, we can produce an image ~5x smaller. A corresponding Maven image, which doesn't have any system dependencies or native helpers is even smaller. $ docker image list
dependabot/dependabot-core-npm_and_yarn ... 738MB
dependabot/dependabot-core-maven ... 541MB
dependabot/dependabot-core ... 3.52GB Of course, moving from Ubuntu / Debian to Alpine (as in #986) would trim things down further, but we don't have any plans to switch distros right now. |
The Docker images are now broken out by ecosystem making them much smaller. We'll continue to work to make and keep them as small as possible. |
dependabot/dependabot-core image from Dockerfile is amazing!
But it now exceeds 1 GB, which is starting to be huge. (why it matters)
Some suggestions to optimize Dependabot's image (sorted by difficulty):
apt
recommandations:apt-get update
should be paired withrm -rf /var/lib/apt/lists/*
in the same layer.apt-get upgrade
must be avoided in a Dockerfile. (ref).--no-install-recommends
whenapt-get
installing packages.build
scripts and an environment variable.golang
is not required to run the helpers once built.The text was updated successfully, but these errors were encountered: