fix: add OpenCode cache volume for version file persistence

OpenCode stores a version file in ~/.cache/opencode/ which was causing
EACCES permission errors. This adds:

- Volume mount for ~/.cache/opencode
- Entrypoint script to set correct ownership/permissions on the cache directory
This commit is contained in:
Soham Dasgupta
2026-01-13 20:45:33 +05:30
parent f073f6ecc3
commit 24a6633322
2 changed files with 15 additions and 0 deletions

View File

@@ -90,6 +90,9 @@ services:
# Persist OpenCode user configuration across container restarts
- automaker-opencode-config:/home/automaker/.config/opencode
# Persist OpenCode cache directory (contains version file and other cache data)
- automaker-opencode-cache:/home/automaker/.cache/opencode
# NO host directory mounts - container cannot access your laptop files
# If you need to work on a project, create it INSIDE the container
# or use a separate docker-compose override file
@@ -123,3 +126,8 @@ volumes:
name: automaker-opencode-config
# Named volume for OpenCode user configuration (~/.config/opencode)
# Persists user configuration across container restarts
automaker-opencode-cache:
name: automaker-opencode-cache
# Named volume for OpenCode cache directory (~/.cache/opencode)
# Contains version file and other cached data

View File

@@ -40,6 +40,13 @@ fi
chown -R automaker:automaker /home/automaker/.config/opencode
chmod -R 700 /home/automaker/.config/opencode
# OpenCode also uses ~/.cache/opencode for cache data (version file, etc.)
if [ ! -d "/home/automaker/.cache/opencode" ]; then
mkdir -p /home/automaker/.cache/opencode
fi
chown -R automaker:automaker /home/automaker/.cache/opencode
chmod -R 700 /home/automaker/.cache/opencode
# If CURSOR_AUTH_TOKEN is set, write it to the cursor auth file
# On Linux, cursor-agent uses ~/.config/cursor/auth.json for file-based credential storage
# The env var CURSOR_AUTH_TOKEN is also checked directly by cursor-agent