name: llm-transformers-image

services:
  image-api:
    image: ${TRANSFORMERS_IMAGE:-llm-transformers-image:latest}
    build:
      context: ../../../../
      dockerfile: core/deploy/docker-gpu/transformers/image.Dockerfile
    container_name: ${TRANSFORMERS_CONTAINER_NAME:-llm-transformers-image}
    restart: unless-stopped
    ipc: host
    ports:
      - "${TRANSFORMERS_HOST_PORT:-8040}:8040"
    environment:
      HF_HOME: /root/.cache/huggingface
      MODEL_PATH: ${MODEL_PATH:-/models/image/sdxl-base-1.0}
      EDIT_MODEL_PATH: ${EDIT_MODEL_PATH:-/models/image/sdxl-inpainting-1.0}
      SERVED_MODEL_NAME: ${SERVED_MODEL_NAME:-sdxl-image}
      PORT: "8040"
      LOAD_ON_START: ${LOAD_ON_START:-1}
      BACKGROUND_LOAD_ON_START: ${BACKGROUND_LOAD_ON_START:-1}
    volumes:
      - ${HOST_APP_DIR:-Z:/LLM/model-chat-app}:/app
      - ${HOST_MODELS_DIR:-Z:/LLM/models}:/models
      - ${HOST_HF_CACHE_DIR:-Z:/LLM/models/cache/huggingface}:/root/.cache/huggingface
    working_dir: /app
    entrypoint: /bin/sh
    command:
      - -lc
      - >
        exec python3 scripts/transformers_plugin_server.py
        --plugin image
        --host 0.0.0.0
        --port 8040
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities:
                - gpu
