services:
  frigate:
    container_name: frigate
    image: ghcr.io/blakeblackshear/frigate:stable
    restart: unless-stopped
    privileged: true
    shm_size: "256mb"
    network_mode: host
    devices:
      - /dev/dri/renderD128:/dev/dri/renderD128
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /opt/homelab/config/frigate/config.yml:/config/config.yml
      - /opt/homelab/config/frigate:/config/credentials:ro
      - /opt/homelab/data/frigate:/media/frigate
    tmpfs:
      - /tmp/cache
    env_file:
      - /opt/homelab/config/frigate/frigate.env
    healthcheck:
      test: ["CMD-SHELL", "wget -q --spider http://localhost:5000/api/version 2>&1 || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
