services:
  app:
    image: ghcr.io/aiirondev/legendary-octo-garbanzo:v0.7.39
    container_name: inventarsystem-app
    restart: unless-stopped
    ports:
      - "10000:8000"
    depends_on:
      - mongodb
      - redis
    environment:
      INVENTAR_MONGODB_HOST: mongodb
      INVENTAR_MONGODB_PORT: "27017"
      INVENTAR_MONGODB_DB: Inventarsystem
      INVENTAR_BACKUP_FOLDER: /data/backups
      INVENTAR_LOGS_FOLDER: /data/logs
    expose:
      - "8000"
    volumes:
      - ./config.json:/app/config.json:ro
      - app_uploads:/app/Web/uploads
      - app_thumbnails:/app/Web/thumbnails
      - app_previews:/app/Web/previews
      - app_qrcodes:/app/Web/QRCodes
      - app_backups:/data/backups
      - app_logs:/data/logs

  mongodb:
    image: mongo:7.0
    container_name: inventarsystem-mongodb
    restart: unless-stopped
    volumes:
      - mongodb_data:/data/db
    healthcheck:
      test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
      interval: 10s
      timeout: 5s
      retries: 10

  redis:
    image: redis:7-alpine
    container_name: inventarsystem-redis
    restart: unless-stopped
    command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  mongodb_data:
  app_uploads:
  app_thumbnails:
  app_previews:
  app_qrcodes:
  app_backups:
  app_logs:
  redis_data:
