You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It builds successfully, however when the last RUN command is executed, it creates a huge layer of size 9.5 GB.
I inspected it with dive, to find that it is all taken by /app/lib/python3.11/site-packages
I thought that whenever I do RUN --mount=type=cache,target=/root/.cache/uv, the packages are cached internally in a local docker instance and it is not a part of the current image that I am building. Is there anything I can do about that? I thought of building a base (reusable) image with thick packages like pytorch and then inheriting from it and installing the other packages, so to split the installation in several layers, but then I would need several .toml project configurations and lock files. So I am curious what is the best way to do that? I am not sure if multi-stage build would help me here, but I might be mistaken.
The text was updated successfully, but these errors were encountered:
I don't quite follow the issue. uv sync installs the packages. If the layer is big because of installed packages, I'm not sure what we could do differently.
Using a cache mount can speed up installation, but won't remove the installed packages from the image because then it'd be broken.
You could try --no-install-package <big-package> to separate that one out from the rest.
Thank you for the suggestion. I thought that if I use RUN --mount=type=cache,target=/root/.cache/uv, it will mount the packages and cache to the image, but now that I think of it, RUN --mount invokes a temporary mount during build time only, so launching scripts won't work - there will be no packages any longer.
I have the following pyproject.toml:
and the following Dockerfile:
It builds successfully, however when the last RUN command is executed, it creates a huge layer of size 9.5 GB.
I inspected it with dive, to find that it is all taken by /app/lib/python3.11/site-packages
I thought that whenever I do
RUN --mount=type=cache,target=/root/.cache/uv
, the packages are cached internally in a local docker instance and it is not a part of the current image that I am building. Is there anything I can do about that? I thought of building a base (reusable) image with thick packages like pytorch and then inheriting from it and installing the other packages, so to split the installation in several layers, but then I would need several .toml project configurations and lock files. So I am curious what is the best way to do that? I am not sure if multi-stage build would help me here, but I might be mistaken.The text was updated successfully, but these errors were encountered: