version: '3.8'

services:
  app:
    build: .
    container_name: qwen-python-merchants_of_hope
    ports:
      - "21000:21000"
    environment:
      - DATABASE_URL=postgresql://user:password@db:5432/merchants_of_hope
      - SECRET_KEY=your-super-secret-key-change-in-production
      - OIDC_ISSUER=${OIDC_ISSUER:-}
      - OIDC_CLIENT_ID=${OIDC_CLIENT_ID:-}
      - OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET:-}
      - OIDC_REDIRECT_URI=${OIDC_REDIRECT_URI:-}
      - DEBUG=${DEBUG:-False}
    depends_on:
      - db
    volumes:
      - ./logs:/app/logs  # For application logs
    networks:
      - merchants_of_hope_network

  db:
    image: postgres:15
    container_name: qwen-python-postgres
    environment:
      - POSTGRES_DB=merchants_of_hope
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=password
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql  # Optional initialization script
    networks:
      - merchants_of_hope_network

  redis:
    image: redis:7-alpine
    container_name: qwen-python-redis
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - merchants_of_hope_network
    command: redis-server --appendonly yes

  nginx:
    image: nginx:alpine
    container_name: qwen-python-nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./ssl:/etc/nginx/ssl  # For SSL certificates
    depends_on:
      - app
    networks:
      - merchants_of_hope_network

volumes:
  postgres_data:
  redis_data:

networks:
  merchants_of_hope_network:
    driver: bridge