version: '3.9'

services:
  frontend:
    build:
      context: ./epi
      dockerfile: Dockerfile
    ports:
      - "5173:5173"
    volumes:
      - ./epi:/app
      - /app/node_modules
    environment:
      - NODE_ENV=development
      - VITE_API_BASE_URL=http://localhost:8000 
    command: npm run dev -- --host 0.0.0.0 --port 5173
    depends_on:
      - backend

  backend:
    build:
      context: ./poppy
      dockerfile: Dockerfile
    ports:
      - "8000:8000"
    volumes:
      - ./poppy:/app
    environment:
      - REDIS_URL=redis://redis:6379/0 
      - ASYNC_DATABASE_URL=sqlite+aiosqlite:///./poppy.db
      - SYNC_DATABASE_URL=sqlite:///./poppy.db
      - XAI_API_KEY=NO_API
      - PYTHONUNBUFFERED=1
    command: >
      uvicorn main:app --host 0.0.0.0 --port 8000 --reload --reload-exclude "*.pyc" --reload-exclude "__pycache__" --reload-exclude "logs" --reload-exclude "media"
    depends_on:
      - redis

  redis:
    image: redis:7-alpine
    ports:
      - "7777:6379"
    command: redis-server --appendonly yes
    volumes:
      - redis-data:/data

volumes:
  redis-data:
