-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
chore(docker): reduce size between docker builds #7571
Conversation
by adding a layer with all the pytorch dependencies that don't change most of the time.
This Dockerfile is also quirky in that it separates There is one thing I haven't confirmed for the space savings: my test builds have been with podman (buildah), not buildkit. buildah doesn't support |
hey @keturn , thanks for this! we tried some time ago with |
Indeed, this is needed to build patchmatch. Hope at some point we no longer have to do this, but for now it's ok. There's still a small benefit to using the runner image because we just don't need to worry about any other cruft that may be left in the builder image, so i'd like to keep it this way for the time being. |
including just invokeai/version seems sufficient to appease uv sync here. including everything else would invalidate the cache we're trying to establish.
This got me to re-visit the docs on docker cache invalidation. From what I gather, the upshot is
well, that's a bit disappointing, but I guess this PR is still a step in the right direction if we are going all-in with uv. |
OK, looks good to me. We'll merge it and I will work on some ideas around re-introducing caching. |
Rebase failed
by adding a layer with all the pytorch dependencies that don't change most of the time.
Summary
Every time the
main
docker images rebuild and I pullmain-cuda
, it gets another 3+ GB, which seems like about a zillion times too much since most things don't change from one commit onmain
to the next.This is an attempt to follow the guidance in Using uv in Docker: Intermediate Layers so there's one layer that installs all the dependencies—including PyTorch with its bundled nvidia libraries—before the project's own frequently-changing files are copied in to the image.
Related Issues / Discussions
uv pip install
torch, but notuv sync
itQA Instructions
Hopefully the CI system building the docker images is sufficient.
But there is one change to
pyproject.toml
related to xformers, so it'd be worth checking thatpython -m xformers.info
still says it has triton on the platforms that expect it.Merge Plan
I don't expect this to be a disruptive merge.
(An earlier revision of this PR moved the venv, but I've reverted that change at ebr's recommendation.)
Checklist
What's New
copy (if doing a release after this PR)