deps_rocker.extensions.cache_perms

Submodules

Classes

CachePerms

Ensure .cache directory exists with proper permissions for the container user

Package Contents

class deps_rocker.extensions.cache_perms.CachePerms

Bases: deps_rocker.simple_rocker_extension.SimpleRockerExtension

Ensure .cache directory exists with proper permissions for the container user

This extension creates ~/.cache in the Dockerfile (as root) with 755 permissions, which allows the user to write to it. This is necessary for tools like uv, pip, etc. to create cache subdirectories without permission errors.

This must run BEFORE other extensions that mount subdirectories under .cache (like claude), so the parent directory exists with correct permissions before the volume mount overrides it.

name = 'cache_perms'
depends_on_extension = ('user',)
get_snippet(cliargs) str

Create .cache directory owned by the user with proper permissions. This ensures the directory exists before volume mounts, preventing Docker from creating it with restrictive permissions. We can’t use chown in the root snippet, so we use world-writable permissions.

invoke_after(cliargs) set

Run after user extension is set up