version: '3.8'

services:
  dbal:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: dbal-daemon
    ports:
      - "8080:8080"
    environment:
      - DBAL_BIND_ADDRESS=0.0.0.0
      - DBAL_PORT=8080
      - DBAL_LOG_LEVEL=info
      - DBAL_MODE=production
    volumes:
      # Optional: Mount custom config
      # - ./config.yaml:/app/config.yaml:ro
      # Optional: Mount data directory
      # - ./data:/app/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 5s

  # Optional: Nginx reverse proxy
  nginx:
    image: nginx:alpine
    container_name: dbal-nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      # - ./ssl:/etc/nginx/ssl:ro  # For SSL certificates
    depends_on:
      - dbal
    restart: unless-stopped

networks:
  default:
    name: dbal-network
