services:
  nut:
    image: dartsteven/nutify:arm64-latest  # Use amd64-latest or armv7-latest based on your architecture
    container_name: Nutify
    privileged: true
    cap_add:
      - SYS_ADMIN
      - SYS_RAWIO
      - MKNOD
    devices:
      - /dev/bus/usb:/dev/bus/usb:rwm
    device_cgroup_rules:
      - 'c 189:* rwm'
    volumes:
      - ./Nutify/logs:/app/nutify/logs
      - ./Nutify/instance:/app/nutify/instance
      - ./Nutify/ssl:/app/ssl
      - ./Nutify/etc/nut:/etc/nut
      - /dev:/dev:rw              # Full /dev access improves hotplug handling
      - /run/udev:/run/udev:ro    # Access to udev events
    environment:
      - SECRET_KEY=mypassword # for password encryption and decryption in the database
      - UDEV=1                    # Improve USB detection
    ports:
      - 3493:3493
      - 5050:5050
      - 443:443
    restart: always
    user: root