Skip to content

Commit b6d0f60

Browse files
JacobCoffeeclaude
andcommitted
Optimize Dockerfile.cabotage layer caching for dependency installs
Copy pyproject.toml first and install dependencies before copying the full source tree. This prevents cache-busting the pip install layer on every source change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 19493a2 commit b6d0f60

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Dockerfile.cabotage

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ WORKDIR /code
3535

3636
RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel
3737

38-
COPY . /code/
38+
COPY pyproject.toml /code/
39+
3940
RUN --mount=type=cache,target=/root/.cache/pip \
4041
set -x \
4142
&& pip --disable-pip-version-check \
4243
install \
4344
'.[prod]'
45+
46+
COPY . /code/
47+
48+
RUN pip --disable-pip-version-check install --no-deps '.'
4449
RUN DJANGO_SETTINGS_MODULE=pydotorg.settings.static python manage.py collectstatic --noinput

0 commit comments

Comments
 (0)