From b5a2bdfdc9efceed6c561b9a33df626fca700885 Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Sat, 3 Oct 2026 18:54:18 +0000 Subject: [PATCH] Keep Poetry's and pip's download caches out of the image poetry install leaves its download cache in ~/.cache/pypoetry, in the same layer. Measured in the current image: 752M of Poetry cache and 26M of pip's, about 780M per image. The dev host keeps two (live and rollback) on the disk that has been the binding constraint on deploys. Removed in the layer that made them; a later rm would hide them but still ship them. Co-Authored-By: Claude Opus 5.5 --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 04ab6529..04f28d68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,11 @@ RUN \ $POETRY_VENV/bin/pip install poetry~=$POETRY_VERSION && \ $POETRY_VENV/bin/poetry config virtualenvs.in-project true && \ $POETRY_VENV/bin/poetry install --no-root --without dev && \ - rm -rf $POETRY_VENV + rm -rf $POETRY_VENV /home/appuser/.cache/pypoetry /home/appuser/.cache/pip +# The caches go in the same layer they were made in: a later `rm` would hide +# them but still ship them. Poetry's download cache alone was ~370M of every +# image, and the dev host keeps two (live + rollback) on a disk that has been +# the binding constraint on deploys. # NLTK data, at build time. BM25 tokenises with # word_tokenize(..., language="english"), which needs punkt_tab -- without it