version: "3.8"

services:
  stripstream-app:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        - NODE_ENV=${NODE_ENV}
        - ADMIN_DEFAULT_PASSWORD=${ADMIN_DEFAULT_PASSWORD}
    container_name: stripstream-app
    restart: unless-stopped
    ports:
      - "3020:3000"
    volumes:
      - stripstream_cache:/app/.cache
      - ${PRISMA_DATA_PATH:-./prisma/data}:/app/prisma/data
    environment:
      - NODE_ENV=${NODE_ENV}
      - DATABASE_URL=file:/app/prisma/data/stripstream.db
      - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
      - NEXTAUTH_URL=${NEXTAUTH_URL}
      - AUTH_TRUST_HOST=true
      - KOMGA_MAX_CONCURRENT_REQUESTS=5
      - ADMIN_DEFAULT_PASSWORD=${ADMIN_DEFAULT_PASSWORD}
      - PRISMA_DATA_PATH=${PRISMA_DATA_PATH:-./prisma/data}
    networks:
      - stripstream-network
    deploy:
      resources:
        limits:
          cpus: "1"
          memory: 1G
    labels:
      - "com.centurylinklabs.watchtower.enable=false"
    healthcheck:
      test:
        ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
      interval: 30s
      timeout: 3s
      retries: 3

networks:
  stripstream-network:
    driver: bridge

volumes:
  stripstream_cache:
