Skip to content

Docker deployment

The repository provides a fixed-tag Docker image for the web runtime. The image contains the exact dependencies from requirements.txt, Node.js for the locked zvec-grep knowledge search engine, and a strict runtime preflight. Secrets and business data stay outside the image.

Build and run

docker compose build
docker compose up -d

The service is available at http://127.0.0.1:8000/app/ and the health endpoint is http://127.0.0.1:8000/api/v1/health. The Compose volume aiquant-data stores the database, uploaded documents, reports, and logs.

Copy .env.example to .env before enabling an external model or messaging channel. Compose loads that file when it exists; it is ignored by Git. For a remote deployment, set ALL_IN_ONE_ACCESS_MODE=token and provide a long local token behind HTTPS.

Isolated tenant deployments

Copy egs/config/operations/tenants.example.yaml to a local manifest and set the image tag, loopback port, CPU, memory, process, and active task ceilings for each tenant. Resolve the credentials entry relative to the manifest directory. Place each .env in a dedicated private directory with a distinct ALL_IN_ONE_ACCESS_TOKEN. Add each tenant's provider credentials and allowed proxy hosts to the corresponding file. The application persists provider key changes made through the tenant workspace in the mounted credential directory.

Build the image once. Then validate the manifest and start the named tenant.

docker compose build
python egs/entrypoints/tenant.py --config path/to/tenants.yaml validate
python egs/entrypoints/tenant.py --config path/to/tenants.yaml up research
python egs/entrypoints/tenant.py --config path/to/tenants.yaml status research
python egs/entrypoints/tenant.py --config path/to/tenants.yaml stop research

Installed distributions offer the same commands through aiquant-tenant. Tenant projects use separate Docker data volumes. HTTPS reverse proxies can forward distinct tenant hostnames to the selected loopback ports and preserve the original Host and HTTPS scheme. Set trusted_proxies to the exact source IP addresses the container sees from that proxy, such as the Docker bridge gateway for a host proxy. The default trusts the loopback addresses. The application uses /_health for container liveness. Docker's resource limits apply to the tenant's container. active_tasks counts leases for foreground and background research work across job types. Infrastructure leases use their existing limits. The sum of tenant capacity should reflect the resources available on the Docker host.

Direct Docker commands

docker build --tag ai-quant-trade:0.1.0 .
docker run --rm --publish 8000:8000 \
  --volume aiquant-data:/var/lib/aiquant/data \
  ai-quant-trade:0.1.0

Add --env-file .env when the local file exists and external providers are enabled. Do not bake .env or a private data directory into an image layer. The .dockerignore file keeps those paths out of the build context.

Private local files

The build context uses a default-deny policy, and the Dockerfile copies explicit runtime sources. Local Codex, TRAE, and WorkBuddy memories, sessions, login state, task documents, audit evidence, private configuration, and environment files are excluded, including copies nested under source or documentation directories. Git ignore rules are independent and protect local agent state while keeping shared project skills eligible for review.

Only the container environment receives credentials supplied through Compose; the build does not copy local agent login or memory files. Avoid printing expanded Compose configuration in shared logs because it can contain values loaded from the local environment file.

Updating the image

Change the Python dependency pins, Node lockfile, or base image tag only after running the repository compatibility and security checks. Rebuild with a new image tag and keep the data volume. The Docker image does not install optional Qlib, image-worker, or messaging profiles; install those profiles in separate runtime images or dedicated environments as documented in the installation guide.