version: '3.8'

services:
  # StreamFlow Unified (Backend + Frontend)
  app:
    image: vndangkhoa/streamflow:latest
    platform: linux/amd64
    ports:
      - "3478:8000"
    environment:
      - REDIS_URL=redis://redis:6379
      - DATABASE_URL=sqlite:///./data/streamflow.db
      - PYTHONUNBUFFERED=1
    volumes:
      - ./backend/data:/app/data
    depends_on:
      redis:
        condition: service_healthy
    restart: unless-stopped

  # Redis Cache
  redis:
    image: redis:7-alpine
    platform: linux/amd64
    ports:
      - "6379:6379"
    volumes:
      - ./redis-data:/data
    restart: unless-stopped
    command: redis-server --appendonly yes
    healthcheck:
      test: [ "CMD", "redis-cli", "ping" ]
      interval: 5s
      timeout: 3s
      retries: 5
