# Ligbox Ops Console — VM123
# Copiar para: /opt/ligbox-ops-console/docker-compose.yml
#
# IMPORTANTE: Esta VM já tem outros serviços Docker/systemd.
# Este compose é ISOLADO — usar apenas:
#   docker compose -f /opt/ligbox-ops-console/docker-compose.yml up -d
# Nunca executar "docker compose down" sem -f apontando só este ficheiro.

name: ligbox-ops-console

services:
  console-ui:
    image: ligbox/ops-console:${CONSOLE_TAG:-latest}
    build:
      context: ./frontend
      dockerfile: Dockerfile
      args:
        VITE_API_URL: ${VITE_API_URL:-https://api.ops.ligbox.com.br}
        VITE_APP_NAME: Ligbox Ops Console
    container_name: ligbox-ops-console-ui
    restart: unless-stopped
    ports:
      # Bind local ou LAN — ajustar conforme preflight-vm123.sh
      - "${CONSOLE_BIND:-127.0.0.1}:${CONSOLE_HOST_PORT:-8100}:80"
    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    environment:
      TZ: ${TZ:-America/Sao_Paulo}
    networks:
      - ligbox-console
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:80/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 15s
    security_opt:
      - no-new-privileges:true
    read_only: true
    tmpfs:
      - /var/cache/nginx:size=32m
      - /var/run:size=1m
      - /tmp:size=16m

networks:
  ligbox-console:
    name: ligbox-console
    driver: bridge

# Não declarar networks externas de outros stacks nesta VM.
# Traefik CT114 faz proxy HTTP para CONSOLE_BIND:CONSOLE_HOST_PORT.
