feat: isolate OpenCode dev state (#816)

This commit is contained in:
Omar McAdam
2026-03-09 17:21:17 -07:00
committed by GitHub
parent 85cddda726
commit 13d79aee07
26 changed files with 455 additions and 71 deletions

View File

@@ -12,10 +12,12 @@
# OPENWORK_PORT — host port to map to container :8787 (default: 8787)
# WEB_PORT — host port to map to container :5173 (default: 5173)
# OPENWORK_DEV_ID — unique ID for this stack (default: default)
# OPENWORK_DEV_MODE — enables isolated OpenCode dev state (set by dev-up.sh)
# OPENWORK_DOCKER_DEV_MOUNT_HOST_OPENCODE=1 — import host OpenCode config/auth into the isolated dev state
# OPENWORK_OPENCODE_CONFIG_DIR — host OpenCode config dir detection override (read by dev-up.sh)
# OPENWORK_OPENCODE_DATA_DIR — host OpenCode data dir detection override (read by dev-up.sh)
# OPENWORK_HOST_OPENCODE_CONFIG_DIR — resolved mount source for host OpenCode config (set by dev-up.sh)
# OPENWORK_HOST_OPENCODE_DATA_DIR — resolved mount source for host OpenCode data (set by dev-up.sh)
# OPENWORK_HOST_OPENCODE_CONFIG_DIR — import source for OpenCode config (set by dev-up.sh)
# OPENWORK_HOST_OPENCODE_DATA_DIR — import source for OpenCode auth/data (set by dev-up.sh)
x-shared: &shared
image: node:22-bookworm-slim
@@ -99,16 +101,6 @@ services:
export OPENWORK_HOST_TOKEN
fi
# --- Import host OpenCode config + auth material when mounted ---
mkdir -p /root/.config/opencode /root/.local/share/opencode
if [ -d /persist/.config/opencode ]; then
cp -R /persist/.config/opencode/. /root/.config/opencode 2>/dev/null || true
fi
if [ -d /persist/.openwork-host-opencode-data ]; then
cp /persist/.openwork-host-opencode-data/auth.json /root/.local/share/opencode/auth.json 2>/dev/null || true
cp /persist/.openwork-host-opencode-data/mcp-auth.json /root/.local/share/opencode/mcp-auth.json 2>/dev/null || true
fi
# Write tokens so the web service can source them
mkdir -p /app/tmp
printf 'OPENWORK_TOKEN=%s\nOPENWORK_HOST_TOKEN=%s\n' \
@@ -149,6 +141,9 @@ services:
OPENWORK_TOKEN: ${OPENWORK_TOKEN:-}
OPENWORK_HOST_TOKEN: ${OPENWORK_HOST_TOKEN:-}
OPENWORK_DEV_ID: ${OPENWORK_DEV_ID:-default}
OPENWORK_DEV_MODE: ${OPENWORK_DEV_MODE:-1}
OPENWORK_DEV_OPENCODE_IMPORT_CONFIG_DIR: /persist/.config/opencode
OPENWORK_DEV_OPENCODE_IMPORT_DATA_DIR: /persist/.openwork-host-opencode-data
OPENWORK_SIDECAR_SOURCE: external
web: