services:
  localsend:
    build:
      context: .
      args:
        LOCALSEND_CLI_REF: ${LOCALSEND_CLI_REF}
    image: localsend-nomad:local
    container_name: localsend-trusted
    hostname: localsend-trusted
    restart: unless-stopped
    environment:
      TZ: ${TZ}
    networks:
      trusted_macvlan:
        ipv4_address: ${LOCALSEND_BIND_IP}
    working_dir: /app/state
    volumes:
      - ${APPDATA_LOCALSEND_ROOT}/state:/app/state
      - ${INBOX_DIR}:/data/inbox
    command:
      - recv
      - --devname
      - ${LOCALSEND_DEVICE_NAME}
      - --dir
      - /data/inbox

networks:
  trusted_macvlan:
    driver: macvlan
    driver_opts:
      parent: ${TRUSTED_PARENT_INTERFACE}
    ipam:
      config:
        - subnet: ${TRUSTED_SUBNET}
          gateway: ${TRUSTED_GATEWAY}
