services:
  vita-crm:
    build: .
    ports:
      - "${PORT:-3000}:3000"
    environment:
      NODE_ENV: production
      HOST: 0.0.0.0
      PORT: 3000
      JWT_SECRET: ${JWT_SECRET}
      ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      ADMIN_FULL_NAME: ${ADMIN_FULL_NAME:-Administrateur VITA}
      DB_PATH: /data/vita-formation.db
      SEED_ON_START: "false"
      SAMPLE_DATA: "false"
      SHOW_DEMO_HINTS: "false"
      TRUST_PROXY: "true"
      CORS_ORIGIN: ${CORS_ORIGIN:-}
    volumes:
      - vita_data:/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 15s

volumes:
  vita_data:
