version: '3.8'

services:
  domain-manager:
    build: .
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - PORT=3000
    volumes:
      # Mount database files to persist data
      - ./comprehensive.db:/app/comprehensive.db
      - ./crm.db:/app/crm.db
      - ./domains.db:/app/domains.db
      - ./notes.db:/app/notes.db
      - ./phones.db:/app/phones.db
      # Mount uploads directory
      - ./public/uploads:/app/public/uploads
    restart: unless-stopped
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:3000" ]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

  # Optional: Add a reverse proxy with nginx
  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - domain-manager
    restart: unless-stopped

volumes:
  database_data:
