Submatter/docker/worker-entrypoint.sh
Randall Stillwell ff3bf83afe
Some checks are pending
CI / Lint, type-check, test (push) Waiting to run
Deploy homelab (CT 116) / Deploy to CT 116 (push) Waiting to run
fix(worker): tolerate OpenCode workspace seed permission errors
Do not abort the entrypoint when the shared volume is not writable; log a
warning and continue so the worker can still start.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:27:17 -05:00

25 lines
952 B
Bash
Executable file

#!/bin/sh
# When a remote harness shares a workspace volume, seed it from the deploy
# snapshot baked into the image (/app/repo).
set -u
session_type="${WORKER_SESSION_TYPE:-minimal}"
if [ "$session_type" = "openhands" ] || [ "$session_type" = "opencode" ]; then
if [ "$session_type" = "opencode" ]; then
target="${WORKER_OPENCODE_WORKSPACE:-/workspace/repo}"
else
target="${WORKER_OPENHANDS_WORKSPACE:-/workspace/repo}"
fi
if [ ! -f "$target/pnpm-workspace.yaml" ]; then
echo "[worker-entrypoint] seeding ${session_type} workspace at ${target}"
mkdir -p "$target" || true
# Volume may be root-owned from an earlier helper container — best-effort seed.
if ! cp -a /app/repo/. "$target/" 2>/tmp/worker-seed.err; then
echo "[worker-entrypoint] WARN: workspace seed failed (continuing with /app/repo):"
cat /tmp/worker-seed.err 2>/dev/null || true
fi
fi
fi
cd /app/apps/worker
exec node dist/index.js