The dependency layer will be invalidated when pyproject.toml changes. But the dependencies usually remain unchanged when a project bumps version. How to share the dependency layer between version updates?
https://docs.docker.com/build/cache/invalidation/#general-rules
|
# Install the project's dependencies using the lockfile and settings |
|
RUN --mount=type=cache,target=/root/.cache/uv \ |
|
--mount=type=bind,source=uv.lock,target=uv.lock \ |
|
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ |
|
uv sync --locked --no-install-project --no-dev |
The dependency layer will be invalidated when
pyproject.tomlchanges. But the dependencies usually remain unchanged when a project bumps version. How to share the dependency layer between version updates?https://docs.docker.com/build/cache/invalidation/#general-rules
uv-docker-example/Dockerfile
Lines 13 to 17 in 6473a50