version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "1GB" # update for your cameras based on calculation above
    cap_add:
      - CAP_PERFMON
    devices:
      - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
      - /dev/bus/usb:/dev/bus/usb # for Google Coral USB-TPU
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/frigate/frigate:/config
      - /media/frigate:/media/frigate
      - type: tmpfs # Optional: 4GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 4000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
      - "8554:8554" # Go2RTC
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
      - "5984:5984" # Go2RTC