services:
  intelligence-terminal:
    image: git.wilkensxl.de/mrsphay/intelligence-terminal:latest
    build:
      context: .
      dockerfile: Dockerfile
    container_name: intelligence-terminal
    env_file:
      - path: .env
        required: false
    environment:
      PORT: ${PORT:-3117}
      AUTO_OPEN_BROWSER: "false"
    ports:
      - "${PORT:-3117}:${PORT:-3117}"
    volumes:
      - ./runs:/app/runs
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:'+(process.env.PORT||3117)+'/api/health').then(r=>{if(![200,503].includes(r.status))process.exit(1);return r.json()}).then(j=>{if(j.status==='error')process.exit(1)}).catch(()=>process.exit(1))"]
      interval: 60s
      timeout: 10s
      start_period: 45s
      retries: 3
