Skip to content

Commit 9a77450

Browse files
Claptarclaude
andcommitted
Make XDG_CACHE_HOME actually writable at runtime
Setting XDG_CACHE_HOME was self-defeating as written: uv honours it, so `uv sync` created /tmp/.cache root-owned and mode 0755 during the build. A task running under `-u $(id -u):$(id -g)` then could not write to the very path the image advertises as its cache, which is worse than leaving the variable unset. Clear the directory and recreate it world-writable in the same layer as the sync. Verified: `mkdir $XDG_CACHE_HOME/probe` now succeeds as an arbitrary UID, where it failed with EACCES before. Reported by Codex review on #12. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 4859445 commit 9a77450

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎Dockerfile‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,18 @@ COPY . .
5252

5353
# --locked asserts that uv.lock is in sync with pyproject.toml, so an image
5454
# can never be built from a lockfile that drifted.
55-
RUN uv sync --locked
55+
#
56+
# uv honours XDG_CACHE_HOME, so the sync leaves a root-owned package cache at
57+
# /tmp/.cache -- which made the variable self-defeating, as a task running
58+
# under an arbitrary UID then could not write to the very path it advertises.
59+
# Clear it and leave an empty world-writable directory behind. Done in this
60+
# same layer because a later `rm` would mask the files without reclaiming
61+
# them; that reclaims about 9 MB, the cache being mostly hardlinks into the
62+
# venv rather than separate copies.
63+
RUN uv sync --locked \
64+
&& rm -rf /tmp/.cache /tmp/uv-*.lock \
65+
&& mkdir -p /tmp/.cache \
66+
&& chmod 1777 /tmp/.cache
5667

5768
# Put the project venv on PATH so `adata` is directly runnable
5869
ENV PATH="/cli/.venv/bin:${PATH}"

0 commit comments

Comments
 (0)