Open ypnos opened 20 hours ago
Symlinks are fairly problematic, since if the cache gets deleted, your entire project will break. I generally would not want to default to them.
We set copy
in the example at https://github.com/astral-sh/uv-docker-example/blob/3d2a5afd814babec58804b9ffce923ea114a76fb/Dockerfile#L10-L11 — needs to be updated over here.
Symlinks are fairly problematic, since if the cache gets deleted, your entire project will break. I generally would not want to default to them.
I use symlink mode at work and I agree with this, I've hit an issue twice where I had to recreate my entire environment, for me it's worth the trade off but I think a user should know they are opting into symlink.
When using a Docker cache mount, as recommended in the documentation, uv falls back to copying instead of hardlinking and complains about it. The message also recommends to suppress the complaint with explicitely setting the link mode to COPY.
See https://github.com/astral-sh/uv/blob/fe4e39a230c1d48c706a031838e76969b43cd2bf/crates/install-wheel-rs/src/linker.rs#L443
As a matter of fact, uv now supports link mode "symlink".
ENV UV_LINK_MODE=symlink
so that people do not run into this issue. See https://docs.astral.sh/uv/guides/integration/docker/#caching