# ─────────────────────────────────────────────────────────────────────────────
# Veylant IA — Public Site Stack (Landing + Documentation)
# Deploy this file in Portainer as a standalone stack.
#
# Variables to set in Portainer → Stacks → Environment:
#   VITE_DASHBOARD_URL   URL of the Veylant dashboard app  (default: http://localhost:3000)
#   VITE_PLAYGROUND_URL  URL of the proxy playground       (default: http://localhost:8090/playground)
#   IMAGE_TAG            Docker image tag to deploy        (default: latest)
# ─────────────────────────────────────────────────────────────────────────────

version: "3.8"

services:
  veylant-public:
    image: ghcr.io/veylant/ia-public:${IMAGE_TAG:-latest}

    # ── Build locally (comment out "image:" above and uncomment this block) ──
    # build:
    #   context: ..                          # project root
    #   dockerfile: web-public/Dockerfile
    #   args:
    #     VITE_DASHBOARD_URL: ${VITE_DASHBOARD_URL:-http://localhost:3000}
    #     VITE_PLAYGROUND_URL: ${VITE_PLAYGROUND_URL:-http://localhost:8090/playground}

    ports:
      - "3001:80"

    environment:
      - VITE_DASHBOARD_URL=${VITE_DASHBOARD_URL:-http://localhost:3000}
      - VITE_PLAYGROUND_URL=${VITE_PLAYGROUND_URL:-http://localhost:8090/playground}

    restart: unless-stopped

    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost/index.html"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s

    labels:
      # Traefik labels — uncomment if using Traefik as reverse proxy
      # - "traefik.enable=true"
      # - "traefik.http.routers.veylant-public.rule=Host(`veylant.io`)"
      # - "traefik.http.routers.veylant-public.entrypoints=websecure"
      # - "traefik.http.routers.veylant-public.tls.certresolver=letsencrypt"
      # - "traefik.http.services.veylant-public.loadbalancer.server.port=80"
      com.veylant.service: "public-site"
      com.veylant.version: "${IMAGE_TAG:-latest}"

networks:
  default:
    name: veylant-public-network
