services:
  email-api:
    container_name: email-api
    image: python:3.12-slim
    restart: unless-stopped
    network_mode: host
    volumes:
      - ./email_api:/app
      - /var/mail:/var/mail  # Maildir-Zugriff für Health-Check
    working_dir: /app
    env_file:
      - .env
    environment:
      - API_TOKEN=${API_TOKEN}
      - AWS_REGION=${AWS_REGION}
      - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
      - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
    command: >
      bash -c "pip install --upgrade pip && 
               pip install flask python-dotenv boto3 requests && 
               python app.py"