37 lines
1.7 KiB
YAML
37 lines
1.7 KiB
YAML
services:
|
|
app:
|
|
image: ghcr.io/anomalyco/opencode:${APP_IMAGE_TAG:-latest}
|
|
container_name: ${STACK_NAME:-opencode}_server
|
|
restart: always
|
|
ports:
|
|
- "${HOST_PORT:-4096}:4096"
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
command:
|
|
- |
|
|
ln -sfn /root/workspaces /workspaces
|
|
git config --global user.name "$$GIT_USER_NAME"
|
|
git config --global user.email "$$GIT_USER_EMAIL"
|
|
git config --global init.defaultBranch main
|
|
git config --global credential.helper store
|
|
GITEA_HOST=$$(echo "$$GITEA_URL" | sed -E 's|^https?://||; s|/+$$||')
|
|
GITEA_PROTO=$$(echo "$$GITEA_URL" | grep -oE '^https?')
|
|
echo "$${GITEA_PROTO}://oauth2:$${GITEA_TOKEN}@$${GITEA_HOST}" > ~/.git-credentials
|
|
chmod 600 ~/.git-credentials
|
|
exec opencode web --port 4096 --hostname 0.0.0.0
|
|
environment:
|
|
- OPENCODE_SERVER_PASSWORD=${OPENCODE_PASSWORD:?error_OPENCODE_PASSWORD_is_required}
|
|
- OPENCODE_SERVER_USERNAME=${OPENCODE_USERNAME:-opencode}
|
|
- GIT_USER_NAME=${GIT_USER_NAME:-OpenCode Agent}
|
|
- GIT_USER_EMAIL=${GIT_USER_EMAIL:-opencode-bot@local.internal}
|
|
- GITEA_URL=${GITEA_URL:?error_GITEA_URL_is_required}
|
|
- GITEA_TOKEN=${GITEA_PAT:?error_GITEA_PAT_is_required}
|
|
- GITHUB_TOKEN=${GITEA_PAT:-}
|
|
- CONTEXT7_API_KEY=${CONTEXT7_API_KEY:-}
|
|
- HA_MCP_URL=${HA_MCP_URL:?error_HA_MCP_URL_is_required}
|
|
volumes:
|
|
- /opt/docker/${STACK_NAME:-opencode}/workspaces:/root/workspaces
|
|
- /opt/docker/${STACK_NAME:-opencode}/config:/root/.config/opencode
|
|
- /opt/docker/${STACK_NAME:-opencode}/data:/root/.local/share/opencode
|
|
- /opt/docker/${STACK_NAME:-opencode}/state:/root/.local/state/opencode
|
|
working_dir: /root/workspaces
|