From 430cd3006e01ada0c7877044992a92f5e0ae252d Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 26 Aug 2024 15:14:47 -0500 Subject: [PATCH] Add tip to use intermediate layers (#6650) --- docs/guides/integration/docker.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/guides/integration/docker.md b/docs/guides/integration/docker.md index b69c05282a62..394fb0f599e5 100644 --- a/docs/guides/integration/docker.md +++ b/docs/guides/integration/docker.md @@ -63,6 +63,11 @@ WORKDIR /app RUN uv sync --frozen ``` +!!! tip + + It is best practice to use [intermediate layers](#intermediate-layers) separating installation + of dependencies and the project itself to improve Docker image build times. + Once the project is installed, you can either _activate_ the virtual environment: ```dockerfile title="Dockerfile" @@ -155,9 +160,9 @@ RUN uv pip install -r requirements.txt ### Installing a project -When installing a project alongside requirements, it is prudent to separate copying the requirements -from the rest of the source code. This allows the dependencies of the project (which do not change -often) to be cached separately from the project itself (which changes very frequently). +When installing a project alongside requirements, it is best practice to separate copying the +requirements from the rest of the source code. This allows the dependencies of the project (which do +not change often) to be cached separately from the project itself (which changes very frequently). ```dockerfile title="Dockerfile" COPY pyproject.toml .