Files
goclaw/docker-compose.yml
fchengyan 52ced3710f fix(build): embed commit SHA for release provenance (#1571 part 2) (#1590)
* fix(build): embed commit SHA for release provenance (#1571 part 2)

Docker builds exclude .git via .dockerignore, so buildvcs cannot read
VCS metadata and published images carry no commit information. A running
image cannot be lined up with the source commit it was built from.

Embed cmd.CommitSHA at link time (maintainer-endorsed option 2) and
surface it in goclaw version output:

- cmd: add CommitSHA var, print commit in version cmd when injected
- Makefile: pass git rev-parse HEAD via LDFLAGS
- Dockerfile: accept COMMIT_SHA build arg (default unknown)
- docker-compose.yml: pass GOCLAW_COMMIT_SHA through as build arg
- release workflows: inject github.sha into release and dev-beta builds

Backward compatible: binaries built without the flag keep the existing
version output format.

* fix(build): pass COMMIT_SHA to docker image builds, surface it in doctor/upgrade

Review follow-up for PR #1590:

- Add COMMIT_SHA=${{ github.sha }} to the build-args of every
  docker/build-push-action step (release.yaml, dev-beta-release.yaml,
  release-beta.yaml, fork-image.yaml) so published images — the
  artifact issue #1571 is about — carry the commit, not just release
  tarball binaries.
- Surface the commit in doctor and upgrade output (App version line)
  via a shared commitSuffix() helper, so operators can read provenance
  from logs without exec'ing goclaw version (review suggestion #2).
- version cmd refactored onto the same helper; output unchanged.
2026-09-30 15:38:53 +07:00

91 lines
2.9 KiB
YAML

# Base docker-compose — shared service definition.
# Pre-built images: ghcr.io/nextlevelbuilder/goclaw (also on Docker Hub: digitop/goclaw)
#
# The default `latest` image includes an embedded web dashboard (no separate nginx needed).
# Web UI is served at the same port as the API (default: 18790).
#
# Quick start:
# docker compose -f docker-compose.yml -f docker-compose.postgres.yml up -d
# # Dashboard: http://localhost:18790
#
# Optional nginx (for custom SSL, reverse proxy, caching):
# make up WITH_WEB_NGINX=1
# # or: docker compose -f docker-compose.yml -f docker-compose.postgres.yml -f docker-compose.selfservice.yml up -d
# # Dashboard via nginx: http://localhost:3000
#
# Docker image variants:
# latest — Backend + embedded web UI + Python (recommended)
# latest-base — Backend API-only, no web UI, no runtimes
# latest-full — All runtimes + skill dependencies pre-installed
# latest-otel — Latest + OpenTelemetry tracing
#
# With OTel tracing: add -f docker-compose.otel.yml
# With Claude CLI: add -f docker-compose.claude-cli.yml
services:
goclaw:
image: ghcr.io/nextlevelbuilder/goclaw:latest
build:
context: ${GOCLAW_DIR:-.}
dockerfile: Dockerfile
args:
ENABLE_OTEL: "${ENABLE_OTEL:-false}"
ENABLE_EMBEDUI: "${ENABLE_EMBEDUI:-true}" # set to false when using WITH_WEB_NGINX
ENABLE_PYTHON: "${ENABLE_PYTHON:-true}"
ENABLE_FULL_SKILLS: "${ENABLE_FULL_SKILLS:-false}"
VERSION: "${GOCLAW_VERSION:-dev}"
COMMIT_SHA: "${GOCLAW_COMMIT_SHA:-}"
# Uncomment to test update UI: GOCLAW_VERSION=v1.0.0
ports:
- "${GOCLAW_PORT:-18790}:18790"
env_file:
- path: .env
required: false
environment:
- GOCLAW_HOST=0.0.0.0
- GOCLAW_PORT=18790
- GOCLAW_CONFIG=/app/data/config.json
- GOCLAW_GATEWAY_TOKEN=${GOCLAW_GATEWAY_TOKEN:?run ./prepare-env.sh or set GOCLAW_GATEWAY_TOKEN}
- GOCLAW_ENCRYPTION_KEY=${GOCLAW_ENCRYPTION_KEY:-}
- GOCLAW_SKILLS_DIR=/app/data/skills
# Debug
- GOCLAW_TRACE_VERBOSE=${GOCLAW_TRACE_VERBOSE:-0}
- BITRIX24_LOG_RAW_EVENT=${BITRIX24_LOG_RAW_EVENT:-0}
- BITRIX24_FORCE_REREGISTER=${BITRIX24_FORCE_REREGISTER:-0}
- BITRIX24_DEBUG_UNREDACTED_TOKEN=${BITRIX24_DEBUG_UNREDACTED_TOKEN:-0}
volumes:
- goclaw-data:/app/data
- goclaw-workspace:/app/workspace
extra_hosts:
- "host.docker.internal:host-gateway"
security_opt:
- no-new-privileges:true
init: true
cap_drop:
- ALL
cap_add:
- SETUID
- SETGID
- CHOWN
tmpfs:
- /tmp:rw,noexec,nosuid,size=256m
deploy:
resources:
limits:
memory: 1G
cpus: '2.0'
pids: 200
networks:
- default
- goclaw-net
restart: unless-stopped
volumes:
goclaw-data:
goclaw-workspace:
networks:
goclaw-net:
name: goclaw-net
driver: bridge