Factory: acceptance runs in throw-away containers via an optional test runner service

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Sonnet 5.5 committed 2026-11-20 06:41:49 +01:00
1 parent 63816c45fd
commit 115e9aec6c
9 files changed
+794 -11

No files matched your search

+37
View File
@@ -32,6 +32,10 @@ services:
- ${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"
@@ -47,6 +51,39 @@ services:
- 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:-node:22-bookworm}
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