uv icon indicating copy to clipboard operation
uv copied to clipboard

Fix Docker integration docs for intermediate layers

Open NiklasRosenstein opened this issue 1 year ago • 2 comments

Summary

The Docker integration docs were missing to mount the uv.lock and pyproject.toml which are required also for the second layer that runs uv sync --locked.

It also failed to mention that if your pyproject.toml references a readme file, that it must be mounted as well.

NiklasRosenstein avatar Sep 07 '24 12:09 NiklasRosenstein

I would also suggest that we add --link-mode=copy to the command to prevent this warning:

#11 0.340 warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
#11 0.340          If the cache and target directories are on different filesystems, hardlinking may not be supported.
#11 0.340          If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.

Uv detects that the cache sits on a different filesystem (yay!), but it's probably a good idea to make this explicit in the Dockerfile.

It's also mandatory to use this option, even if you don't use a cache mount, if you plan on copying only your project directory from another stage (e.g. when combining multiple stages), you likely won't think about copying (and merging!) the UV cache directory. Admittedly, that is a bit of an edge case.

Adding --compile-bytecode might also be a good idea!

edit: I've made these changes in ea61ed1c4308a942e5773ca9ebf8adc1b3c8b7db, let me know what you think.

NiklasRosenstein avatar Sep 07 '24 12:09 NiklasRosenstein

Thanks for contributing! I have a couple questions :)

zanieb avatar Sep 07 '24 14:09 zanieb