From 89f799fa613778fadd2f0b8b6713ca75ca78431e Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Thu, 23 Oct 2025 16:12:52 +0100 Subject: [PATCH 1/2] Use shared volume for devcontainer uv cache Instead of mounting the user's local cache. For the first use this will be slower (if the user has previously used uv) but using a separate volume means links within the cache referring to devcontainer locations will not interfere with uv being run from outside the container. Using a named volume means devcontainers for multiple projects can share the same cache. --- .devcontainer/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index de182095..693beaf9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -56,9 +56,9 @@ }, // Keep a persistent cross container cache for uv { - "source": "${localEnv:HOME}/.cache/uv", + "source": "persistent-uv-cache", "target": "/root/.cache/uv", - "type": "bind" + "type": "volume" }, // Use a volume mount for the uv venv so it is local to the container { From 1509ae6d4ffe70d43203d76789c076edf200f074 Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Thu, 23 Oct 2025 16:23:14 +0100 Subject: [PATCH 2/2] Use shared cache for pre-commit hooks Once the uv cache has been set up, configuring the pre-commit hooks takes the most significant amount of time building the container. Using a shared volume for the pre-commit cache as well takes the devcontainer re-build time from ~1m10s to ~10s. --- .devcontainer/devcontainer.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 693beaf9..2056f9c7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -60,6 +60,12 @@ "target": "/root/.cache/uv", "type": "volume" }, + // ...and for pre-commit + { + "source": "persistent-pre-commit-cache", + "target": "/root/.cache/pre-commit", + "type": "volume" + }, // Use a volume mount for the uv venv so it is local to the container { "target": "/workspaces/${localWorkspaceFolderBasename}/.venv",