version: "3.9"

services:
  app:
    build: .
    container_name: ls-system
    restart: unless-stopped
    ports:
      - "${PORT:-3000}:3000"
    volumes:
      - ls-data:/app/backend/data
      - ls-uploads:/app/backend/uploads
      - ls-backups:/app/backups
    environment:
      - NODE_ENV=production
      - PORT=3000
      - JWT_SECRET=${JWT_SECRET:?Set JWT_SECRET in .env}
      - JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-7d}
      - CLIENT_ORIGIN=${CLIENT_ORIGIN:-}
      - DB_PATH=/app/backend/data/learnspace.db
      - UPLOADS_DIR=/app/backend/uploads
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
      interval: 30s
      timeout: 5s
      start_period: 10s
      retries: 3

volumes:
  ls-data:
  ls-uploads:
  ls-backups:
