version: '3.8'

services:
  whatscrm:
    build: .
    container_name: whatscrm-app
    restart: unless-stopped
    env_file:
      - .env
    volumes:
      - ./logs:/app/logs
      - ./database:/app/database
    networks:
      - traefik-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whatscrm.rule=Host(`whatscrm.gabsdev.com`)"
      - "traefik.http.routers.whatscrm.tls=true"
      - "traefik.http.routers.whatscrm.tls.certresolver=letsencrypt"
      - "traefik.http.services.whatscrm.loadbalancer.server.port=3001"

  postgres:
    image: postgres:15-alpine
    container_name: whatscrm-postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: whatscrm_db
      POSTGRES_USER: whatscrm_user
      POSTGRES_PASSWORD: whatscrm_pass_2026
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - traefik-network

networks:
  traefik-network:
    external: true

volumes:
  postgres_data: