version: '3.8'

services:
  app:
    build: .
    container_name: inmobot-crm-app
    ports:
      - "3001:3001"
    environment:
      - NODE_ENV=production
      - DATABASE_URL=postgresql://inmobot:senha123@postgres:5432/inmobot_crm
      - REDIS_URL=redis://redis:6379
    depends_on:
      - postgres
      - redis
    volumes:
      - ./logs:/app/logs
      - ./.env:/app/.env
    restart: unless-stopped
    networks:
      - inmobot-network

  postgres:
    image: postgres:15-alpine
    container_name: inmobot-crm-postgres
    environment:
      POSTGRES_DB: inmobot_crm
      POSTGRES_USER: inmobot
      POSTGRES_PASSWORD: senha123
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: unless-stopped
    networks:
      - inmobot-network

  redis:
    image: redis:7-alpine
    container_name: inmobot-crm-redis
    command: redis-server --appendonly yes
    volumes:
      - redis_data:/data
    ports:
      - "6379:6379"
    restart: unless-stopped
    networks:
      - inmobot-network

  pgadmin:
    image: dpage/pgadmin4
    container_name: inmobot-crm-pgadmin
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@inmobot.com
      PGADMIN_DEFAULT_PASSWORD: admin123
    ports:
      - "5050:80"
    depends_on:
      - postgres
    restart: unless-stopped
    networks:
      - inmobot-network

volumes:
  postgres_data:
  redis_data:

networks:
  inmobot-network:
    driver: bridge