version: '3.8'

services:
  # Banco de dados PostgreSQL para desenvolvimento
  db:
    image: postgres:15-alpine
    container_name: allure_db_dev
    environment:
      POSTGRES_DB: allure_dev
      POSTGRES_USER: allure_user
      POSTGRES_PASSWORD: allure_password
    volumes:
      - postgres_dev_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    networks:
      - allure_dev_network

  # Aplicação Django para desenvolvimento
  web:
    build: .
    container_name: allure_web_dev
    environment:
      - DEBUG=True
      - SECRET_KEY=dev-secret-key-not-for-production
      - DATABASE_URL=postgresql://allure_user:allure_password@db:5432/allure_dev
      - ALLOWED_HOSTS=*
    volumes:
      - .:/app
      - ./media:/app/media
    ports:
      - "8000:8000"
    depends_on:
      - db
    networks:
      - allure_dev_network
    command: >
      sh -c "python manage.py migrate &&
             python manage.py runserver 0.0.0.0:8000"

volumes:
  postgres_dev_data:

networks:
  allure_dev_network:
    driver: bridge
