Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
90 lines
3.7 KiB
YAML
90 lines
3.7 KiB
YAML
# CodeCraft – copy .env.example to .env and adjust, then: docker compose up -d --build
|
||
#
|
||
# Persistent state lives in the named volume "codecraft-data" (mounted at /data):
|
||
# /data/config.toml configuration (also editable in the web UI)
|
||
# /data/codecraft.db sessions, messages, statistics
|
||
# /data/home home directory of the agent (git config, caches, ...)
|
||
# Rebuilding or recreating the container keeps all of it.
|
||
services:
|
||
codecraft:
|
||
build:
|
||
context: .
|
||
args:
|
||
# Shown in Settings and /api/health: GIT_COMMIT=$(git rev-parse --short HEAD) docker compose build
|
||
GIT_COMMIT: ${GIT_COMMIT:-}
|
||
image: codecraft:latest
|
||
container_name: codecraft
|
||
restart: unless-stopped
|
||
# Same UID/GID as the owner of your project files.
|
||
user: "${UID:-1000}:${GID:-1000}"
|
||
# Bound to localhost by default: expose it through a TLS reverse proxy.
|
||
# Set BIND_ADDR=0.0.0.0 to publish it on all interfaces.
|
||
ports:
|
||
- "${BIND_ADDR:-127.0.0.1}:${PORT:-8787}:8787"
|
||
# All variables from .env are available to the config as ${NAME}
|
||
# (provider keys, MCP tokens, OIDC secret, initial admin).
|
||
env_file:
|
||
- path: .env
|
||
required: false
|
||
volumes:
|
||
- codecraft-data:/data
|
||
# The projects the agents may work on.
|
||
- ${WORKSPACE:-./workspace}:/workspace
|
||
# Separate area for the software factory (clones of the watched repositories).
|
||
- ${FACTORY_DIR:-./factory}:/factory
|
||
environment:
|
||
# The test runner below (empty = acceptance runs start the app inside this container).
|
||
CODECRAFT_RUNNER_URL: ${CODECRAFT_RUNNER_URL:-}
|
||
CODECRAFT_RUNNER_TOKEN: ${RUNNER_TOKEN:-}
|
||
# Reach self-hosted models (Ollama, vLLM, ...) on the host.
|
||
extra_hosts:
|
||
- "host.docker.internal:host-gateway"
|
||
shm_size: "1gb" # Chromium (craft mode)
|
||
# Shell commands of non-admin users run in a bubblewrap sandbox. It needs
|
||
# user namespaces: a seccomp profile that adds exactly those syscalls to
|
||
# Docker's default, AppArmor relaxed for the namespace mounts, and an
|
||
# unmasked /proc so the sandbox can mount its own (hiding server processes).
|
||
# Remove these three lines and set [sandbox] mode = "off" if you are the
|
||
# only user.
|
||
security_opt:
|
||
- seccomp=./docker/seccomp-sandbox.json
|
||
- apparmor=unconfined
|
||
- systempaths=unconfined
|
||
|
||
# Optional: throw-away containers for the factory's acceptance runs. Enable with
|
||
# COMPOSE_PROFILES=runner RUNNER_TOKEN=<random string> CODECRAFT_RUNNER_URL=http://testrunner:8788
|
||
# in .env. The factory then starts each app under test in its own container and
|
||
# network (plus helper services such as a database) and removes it afterwards.
|
||
# This service owns the Docker socket – the CodeCraft container does not.
|
||
testrunner:
|
||
profiles: ["runner"]
|
||
image: codecraft:latest
|
||
command: ["testrunner"]
|
||
container_name: codecraft-testrunner
|
||
restart: unless-stopped
|
||
user: "${UID:-1000}:${GID:-1000}"
|
||
# Group that owns /var/run/docker.sock on the host: stat -c %g /var/run/docker.sock
|
||
group_add:
|
||
- "${DOCKER_GID:-999}"
|
||
environment:
|
||
RUNNER_TOKEN: ${RUNNER_TOKEN:-}
|
||
RUNNER_FACTORY_DIR: /factory
|
||
RUNNER_MEMORY: ${RUNNER_MEMORY:-2g}
|
||
RUNNER_CPUS: ${RUNNER_CPUS:-2}
|
||
RUNNER_DEFAULT_IMAGE: ${RUNNER_DEFAULT_IMAGE:-git.familie-zink.org/zink/codecraft-testbase:latest}
|
||
HOME: /tmp
|
||
volumes:
|
||
- /var/run/docker.sock:/var/run/docker.sock
|
||
# Read-only: the sources are copied into the containers, never mounted.
|
||
- ${FACTORY_DIR:-./factory}:/factory:ro
|
||
read_only: true
|
||
tmpfs:
|
||
- /tmp
|
||
cap_drop: [ALL]
|
||
security_opt:
|
||
- no-new-privileges:true
|
||
|
||
volumes:
|
||
codecraft-data:
|
||
name: codecraft-data
|