# vim: ft=systemd
[Unit]
Description=Immich machine learning container
After=network.target

[Container]
Environment=IMMICH_VERSION={{ immich_version }}
{% if immich_hw_accel == 'nvidia' %}
Image=ghcr.io/immich-app/immich-machine-learning:{{ immich_version }}-cuda
{% elif immich_hw_accel == 'intel' %}
Image=ghcr.io/immich-app/immich-machine-learning:{{ immich_version }}-openvino
{% else %}
Image=ghcr.io/immich-app/immich-machine-learning:{{ immich_version }}
{% endif %}

Volume={{ immich_model_cache_dir }}:/cache

{% if immich_hw_accel == 'nvidia' %}
# Nvidia GPU access via CDI - requires nvidia-container-toolkit with CDI configured:
#   nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
AddDevice=nvidia.com/gpu=all
{% elif immich_hw_accel == 'intel' %}
# Intel GPU and OpenVINO device access
AddDevice=/dev/dri
Volume=/dev/bus/usb:/dev/bus/usb
{% endif %}

PublishPort=0.0.0.0:8028:3003

User=0

[Service]
Restart=always

[Install]
WantedBy=default.target
