version: '3.8' services: chroma: image: chromadb/chroma:latest volumes: - ./data/chroma:/chroma/chroma_storage ports: - "8001:8000" environment: - CHROMA_SERVER_HOST=0.0.0.0 - CHROMA_SERVER_PORT=8000 healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/heartbeat"] interval: 10s timeout: 5s retries: 5 api: build: context: . dockerfile: Dockerfile volumes: - ./data:/app/data - ./app:/app/app ports: - "8000:8000" environment: - OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-} - OPENROUTER_MODEL=${OPENROUTER_MODEL:-stepfun/step-3.5-flash:free} - GITEA_TOKEN=${GITEA_TOKEN:-} - GITEA_OWNER=${GITEA_OWNER:-cal} - GITEA_REPO=${GITEA_REPO:-strat-chatbot} - DATA_DIR=/app/data - RULES_DIR=/app/data/rules - CHROMA_DIR=/app/data/chroma - DB_URL=sqlite+aiosqlite:///./data/conversations.db - CONVERSATION_TTL=1800 - TOP_K_RULES=10 - EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2 depends_on: chroma: condition: service_healthy command: > sh -c " # Wait for database file creation on first run sleep 2 && # Initialize database if it doesn't exist python -c 'import asyncio; from app.database import ConversationManager; mgr = ConversationManager(\"sqlite+aiosqlite:///./data/conversations.db\"); asyncio.run(mgr.init_db())' || true && uvicorn app.main:app --host 0.0.0.0 --port 8000 " healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 15s timeout: 10s retries: 3 start_period: 30s discord-bot: build: context: . dockerfile: Dockerfile volumes: - ./data:/app/data - ./app:/app/app environment: - OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-} - OPENROUTER_MODEL=${OPENROUTER_MODEL:-stepfun/step-3.5-flash:free} - DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-} - DISCORD_GUILD_ID=${DISCORD_GUILD_ID:-} - API_BASE_URL=http://api:8000 depends_on: api: condition: service_healthy # Override the default command to run the Discord bot command: > sh -c " echo 'Waiting for API to be ready...' && while ! curl -s http://api:8000/health > /dev/null; do sleep 2; done && echo 'API ready, starting Discord bot...' && python -m app.discord_bot " restart: unless-stopped volumes: chroma_data: app_data: