name: lhia-replies-full
services:
  # --- BASES DE DATOS & CACHE ---
  postgres:
    image: postgres:15-alpine
    container_name: lhia-postgres-dev
    ports:
      - "5412:5432"
    environment:
      - POSTGRES_DB=lhia_db
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    volumes:
      - lhia_postgres_data:/var/lib/postgresql/data
    networks:
      - lhia-replies-net


  redis:
    image: redis:7-alpine
    container_name: lhia-redis-dev
    ports:
      - "6379:6379"
    volumes:
      - lhia_redis_data:/data
    networks:
      - lhia-replies-net

  # --- MICROSERVICIOS DE APLICACION ---

  lhia-agent:
    build:
      context: ./lhia-v3-agent
    image: ${DOCKER_REGISTRY}/lhia-v3-agent:${IMAGE_TAG}
    container_name: ${CLIENT_NAME}-lhia-v3-agent
    ports:
      - "${PORT_AGENT}:${PORT_AGENT}"
    env_file:
      - .env
    depends_on:
      - redis
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      - lhia-replies-net

  facebook:
    build:
      context: ./facebook
    image: ${DOCKER_REGISTRY}/lhia-facebook:${IMAGE_TAG}
    container_name: ${CLIENT_NAME}-lhia-facebook
    ports:
      - "${PORT_FB}:${PORT_FB}"
    env_file:
      - .env
    depends_on:
      - postgres
      - lhia-agent
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      - lhia-replies-net

  instagram:
    build:
      context: ./instagram
    image: ${DOCKER_REGISTRY}/lhia-instagram:${IMAGE_TAG}
    container_name: ${CLIENT_NAME}-lhia-instagram
    ports:
      - "${PORT_IG}:${PORT_IG}"
    env_file:
      - .env
    depends_on:
      - postgres
      - lhia-agent
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      - lhia-replies-net

volumes:
  lhia_postgres_data:

  lhia_redis_data:

networks:
  lhia-replies-net:
    driver: bridge
    ipam:
      config:
        - subnet: ${DOCKER_SUBNET}
