# SanadR1 on the R1 EDU backpack.
#
#   cd ~/SanadR1/docker
#   cp .env.example .env      # then put your SANAD_GEMINI_API_KEY in it
#   docker compose up -d --build
#
# `network_mode: host` is REQUIRED: the robot's CycloneDDS discovery + the
# on-board mic UDP multicast (239.168.123.161:5555) do not cross a bridge NAT,
# and the dashboard must bind the host's eth10 / wlan0 addresses.
services:
  sanadr1:
    build:
      context: ..                 # the SanadR1 folder (parent of docker/)
      dockerfile: docker/Dockerfile
    image: sanadr1:latest
    container_name: sanadr1
    network_mode: host            # DDS + audio multicast + bind wlan0/eth10
    restart: unless-stopped       # auto-starts on boot (docker.service enabled)
    env_file:
      - .env                      # SANAD_GEMINI_API_KEY=...
    environment:
      - SANAD_DDS_INTERFACE=eth10
      - SANAD_DASHBOARD_HOST=0.0.0.0
      - SANAD_NAV_TOOLS=0
      - SANAD_AUDIO_PROFILE=builtin
      - SANAD_VOICE_BRAIN=gemini
    volumes:
      # Named volumes auto-populate from the image on first run, then persist
      # the dashboard's writes (recordings, faces, zones, tuned runtime config
      # which lives under data/motions/config.json). config/ is left tracking the
      # image (read-only defaults) so `up --build` can ship updated defaults.
      - sanadr1_data:/opt/SanadR1/data
      - sanadr1_logs:/opt/SanadR1/logs

volumes:
  sanadr1_data:
  sanadr1_logs:
