version: '3.8'

services:
  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 30s
      timeout: 10s
      retries: 5

  web:
    build: .
    ports:
      - "8000:8000"
    environment:
      - SECRET_KEY=django-insecure-dev-key-change-in-production
      - DEBUG=False
      - ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0
      - CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
      - REDIS_URL=redis://redis:6379/0
    depends_on:
      redis:
        condition: service_healthy
    volumes:
      - ./db.sqlite3:/app/db.sqlite3
      - ./logs:/app/logs
      - ./staticfiles:/app/staticfiles

volumes:
  redis_data:
