version: '3.8'

services:
  dss:
    build: .
    container_name: dss-server
    restart: unless-stopped
    ports:
      - "3456:3456"
    env_file:
      - .env
    environment:
      - NODE_ENV=production
      - HOST=0.0.0.0
      - PORT=3456
      - DATABASE_PATH=/app/.dss/dss.db
      - PYTHONPATH=/app/tools
    volumes:
      # Persistent data
      - dss-data:/app/.dss
      # Optional: Mount custom config
      # - ./custom.env:/app/.env:ro
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3456/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

  # Optional: Redis for caching (if using Celery)
  # redis:
  #   image: redis:7-alpine
  #   container_name: dss-redis
  #   restart: unless-stopped
  #   ports:
  #     - "127.0.0.1:6379:6379"
  #   volumes:
  #     - redis-data:/data
  #   command: redis-server --appendonly yes

volumes:
  dss-data:
    driver: local
  # redis-data:
  #   driver: local

networks:
  default:
    name: dss-network
