Skip to content

Commit afc6f54

Browse files
committed
Add Docker build cache mounts for pip, uv, and npm with project-specific IDs
Closes #1131
1 parent 774eeb0 commit afc6f54

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
* Added CLAUDE.md with project overview and development commands for Claude Code
99
* Added Docker Compose healthchecks for PostgreSQL, Redis, and Vite services to ensure reliable service startup
10+
* Added Docker build cache mounts for pip, uv, and npm with project-specific IDs to speed up builds
1011

1112
### Changed
1213

config/docker/Dockerfile.web

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,21 @@ ENV \
1313
PYTHONUNBUFFERED=1 \
1414
UV_PROJECT_ENVIRONMENT=$VIRTUAL_ENV
1515

16-
RUN set -ex \
16+
RUN --mount=type=cache,target=/root/.cache/pip,id=django-base-site-pip \
17+
set -ex \
1718
&& python3 -m venv $VIRTUAL_ENV \
1819
&& $VIRTUAL_ENV/bin/pip install -U setuptools wheel pip uv
1920

2021
# Install Python packages
2122
COPY uv.lock pyproject.toml ./
2223

23-
RUN set -ex \
24+
RUN --mount=type=cache,target=/root/.cache/uv,id=django-base-site-uv \
25+
set -ex \
2426
&& if [ "$ENV_NAME" = "prod" ]; then \
2527
$VIRTUAL_ENV/bin/uv sync --no-dev; \
2628
else \
2729
$VIRTUAL_ENV/bin/uv sync; \
28-
fi \
29-
&& rm -rf /root/.cache/
30+
fi
3031

3132

3233
# ------------------------------------------------------------
@@ -76,7 +77,8 @@ COPY package.json package-lock.json ./
7677
COPY src src
7778

7879
# Install Node packages
79-
RUN npm ci \
80+
RUN --mount=type=cache,target=/root/.npm,id=django-base-site-npm \
81+
npm ci \
8082
&& npm run build \
8183
&& ls -la public/static/dist/
8284

scripts/start_new_project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ EOF
9494
just clean_extra_files
9595
sed -i '' "s|image: epicserve/django-base-site|image: ${PROJECT_NAME_SLUG}|" compose.yml
9696
sed -i '' "s|django-base-site|${PROJECT_NAME_SLUG}|" justfile
97+
sed -i '' "s|django-base-site|${PROJECT_NAME_SLUG}|" config/docker/Dockerfile.web
9798
find ./public -name ".keep" | xargs rm -rf
9899

99100
echo ""

0 commit comments

Comments
 (0)