Files
agent_alpha/docker-compose.yml
T

115 lines
3.9 KiB
YAML

# ──────────────────────────────────────────────────────────────────
# Agent Alpha — Docker Compose
#
# Usage:
# docker compose up -d # start everything
# docker compose up -d --build # rebuild & start
# docker compose down # stop & remove
#
# Requires:
# - Docker (or Podman with docker-compose compatibility)
# - An OpenAI-compatible LLM endpoint (set LLM_BASE_URL)
# ──────────────────────────────────────────────────────────────────
services:
# ── FastAPI Backend ─────────────────────────────────────────────
backend:
build:
context: .
dockerfile: backend/Dockerfile
container_name: agent-alpha-backend
ports:
- "8000:8000"
environment:
# NOTE: URLs are hardcoded to container service names so that the
# host .env file (with localhost URLs) does NOT override them.
# LLM: use host.docker.internal (resolved via extra_hosts) so the
# container reaches the LLM running on the host machine.
- LLM_BASE_URL=http://host.docker.internal:8011/v1
- LLM_MODEL=${LLM_MODEL:-llama}
- DATABASE_URL=${DATABASE_URL:-postgresql+asyncpg://agent_alpha:agent_alpha@postgres:5432/agent_alpha}
- VALKEY_URL=${VALKEY_URL:-redis://valkey:6379/0}
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
# Uncomment to use a local .env file instead of env vars:
# env_file:
# - .env
# Podman: use host.containers.internal; Docker Desktop: host.docker.internal
extra_hosts:
- "host.docker.internal:host-gateway"
- "host.containers.internal:host-gateway"
# ── React Frontend (nginx) ──────────────────────────────────────
frontend:
build:
context: frontend
dockerfile: Dockerfile
container_name: agent-alpha-frontend
ports:
- "5173:80"
depends_on:
- backend
restart: unless-stopped
# ── PostgreSQL ──────────────────────────────────────────────────
postgres:
image: postgres:16-alpine
container_name: agent-alpha-postgres
ports:
- "5432:5432"
environment:
POSTGRES_USER: agent_alpha
POSTGRES_PASSWORD: agent_alpha
POSTGRES_DB: agent_alpha
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U agent_alpha -d agent_alpha"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
# ── Valkey (Redis-compatible) ──────────────────────────────────
valkey:
image: valkey/valkey:8-alpine
container_name: agent-alpha-valkey
ports:
- "6379:6379"
volumes:
- valkey_data:/data
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
# ── Ollama (optional — uncomment to run the LLM locally) ────────
# ollama:
# image: ollama/ollama:latest
# container_name: ollama
# ports:
# - "11434:11434"
# volumes:
# - ollama_data:/root/.ollama
# restart: unless-stopped
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
# capabilities: [gpu]
volumes:
postgres_data:
valkey_data:
# ollama_data: