version: "3.9"

# Self-hosted ThriftLM stack.
# Supabase is external — set SUPABASE_URL and SUPABASE_KEY in .env.
# Redis runs as a local container.

services:
  redis:
    image: redis:7-alpine
    restart: unless-stopped
    ports:
      - "6379:6379"
    command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru

  api:
    build:
      context: .
      dockerfile: Dockerfile
    restart: unless-stopped
    ports:
      - "8000:8000"
    env_file:
      - .env
    environment:
      THRIFTLM_URL: http://localhost:8000
      REDIS_URL: redis://redis:6379
    depends_on:
      - redis
    command: uvicorn api.main:app --host 0.0.0.0 --port 8000
