Skip to content

Commit e855d1c

Browse files
robtaylorclaude
andcommitted
perf: Add uv cache to Docker build
The uv cache contains all Python wheel files (807MB) and is the primary cache that speeds up PDM installations. This was previously missing from the cache warming strategy. Changes: - Added /opt/chipflow-cache/uv directory - Copy ~/.cache/uv to /opt/chipflow-cache/uv at end of Docker build - Copy /opt/chipflow-cache/uv to ~/.cache/uv in post-create.sh Cache sizes in Docker image: - PDM: 116KB (metadata only) - uv: 807MB (Python wheels - main cache!) - yowasp-yosys: 126MB (WASM JIT compilation) - zig: 79MB (Zig toolchain compilation) Total: ~1.01GB cached in prebuild 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 5c84ec7 commit e855d1c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ RUN --mount=type=bind,target=/src \
5050
cp /src/pyproject.toml . && \
5151
cp /src/pdm.lock . && \
5252
pdm config use_uv true && \
53-
mkdir -p /opt/chipflow-cache/pdm /opt/chipflow-cache/yowasp /opt/chipflow-cache/zig && \
53+
mkdir -p /opt/chipflow-cache/pdm /opt/chipflow-cache/yowasp /opt/chipflow-cache/zig /opt/chipflow-cache/uv && \
5454
pdm config cache_dir /opt/chipflow-cache/pdm && \
5555
export YOWASP_CACHE_DIR=/opt/chipflow-cache/yowasp && \
5656
export ZIG_GLOBAL_CACHE_DIR=/opt/chipflow-cache/zig && \
@@ -67,4 +67,6 @@ RUN --mount=type=bind,target=/src \
6767
pdm run chipflow pin lock && \
6868
pdm run chipflow sim build && \
6969
cd .. && \
70-
rm -rf cache-warming-temp
70+
rm -rf cache-warming-temp && \
71+
echo "Copying uv cache to /opt/chipflow-cache" && \
72+
cp -r ~/.cache/uv/* /opt/chipflow-cache/uv/

.devcontainer/post-create.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ if [ -n "$CODESPACE_NAME" ]; then
2020
RETRY_DELAY=3
2121
HTTP_CODE="404"
2222

23+
# Copy uv cache from Docker image (contains Python wheels - 800MB+)
24+
echo "🔥 Copying uv cache..."
25+
mkdir -p ~/.cache/uv
26+
if [ -d /opt/chipflow-cache/uv ] && [ "$(ls -A /opt/chipflow-cache/uv)" ]; then
27+
cp -r /opt/chipflow-cache/uv/* ~/.cache/uv/
28+
echo "✅ uv cache copied"
29+
else
30+
echo "⚠️ No uv cache found"
31+
fi
32+
2333
# Copy PDM cache from Docker image
2434
echo "🔥 Copying PDM cache..."
2535
mkdir -p ~/.cache/pdm

0 commit comments

Comments
 (0)