name: immich-ml services: immich-machine-learning: container_name: immich_machine_learning image: ghcr.io/immich-app/immich-machine-learning:release restart: unless-stopped ports: - "3003:3003" volumes: - /opt/docker/immich-ml/cache:/cache - /opt/docker/immich-ml/logs:/logs environment: HF_TOKEN: "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" # Оптимизация под 6000 фото и 4 ГБ RAM MACHINE_LEARNING_REQUEST_THREADS: "1" MACHINE_LEARNING_MODEL_THREADS: "1" MACHINE_LEARNING_MODEL_TTL: "300" # Пути к кэшу TRANSFORMERS_CACHE: /cache HF_HOME: /cache # Оптимизация Python PYTHONDONTWRITEBYTECODE: "1" PYTHONUNBUFFERED: "1" # Логирование LOG_LEVEL: "info" # Ограничение ресурсов (важно для LXC!) deploy: resources: limits: memory: 2G cpus: '2.0' reservations: memory: 1G # Health check healthcheck: test: [ "CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3003/ping')" ] interval: 30s timeout: 10s retries: 3 start_period: 60s # Logging logging: driver: "json-file" options: max-size: "10m" max-file: "3" # Volume для кэша моделей volumes: model-cache: driver: local driver_opts: type: none o: bind device: /opt/docker/immich-ml/cache