MojoLlama
Archived Mojo/MAX quantizer and serving research repository (read-only history)
Brought by drakestapleton
MojoLlama / docker-compose.yml
| 1 | # ============================================================================= |
| 2 | # MojoLlama — Docker Compose (5 Backend Images) |
| 3 | # |
| 4 | # Quick start: |
| 5 | # docker compose up cpu # CPU (TurboEngine AVX2 + llama.cpp CPU) |
| 6 | # docker compose up cuda # NVIDIA GPU + MAX backend |
| 7 | # docker compose up rocm # AMD GPU + MAX backend |
| 8 | # docker compose up vulkan # Universal GPU (Vulkan) |
| 9 | # docker compose up sycl # Intel GPU (SYCL/oneAPI) |
| 10 | # |
| 11 | # With custom model: |
| 12 | # MODEL_PATH=/path/to/model.gguf docker compose up cpu |
| 13 | # |
| 14 | # Benchmark mode (tests all backends, picks fastest): |
| 15 | # MOJOLLAMA_BENCHMARK=true docker compose up cpu |
| 16 | # |
| 17 | # Force specific backend: |
| 18 | # MOJOLLAMA_BACKEND=max docker compose up cuda |
| 19 | # MOJOLLAMA_BACKEND=turbo_engine docker compose up cpu |
| 20 | # ============================================================================= |
| 21 | |
| 22 | x-common: &common |
| 23 | container_name: mojollama-server |
| 24 | ports: |
| 25 | - "${HOST_PORT:-8080}:8080" |
| 26 | - "${LLAMA_PORT:-8081}:8081" |
| 27 | volumes: |
| 28 | - "${MODEL_VOLUME:-./models}:/models:ro" |
| 29 | - "mojollama-config:/home/mojollama/.mojollama" |
| 30 | environment: |
| 31 | - MODEL_PATH=${MODEL_PATH:-/models/tinyllama-1.1b.Q4_K_M.gguf} |
| 32 | - PORT=${PORT:-8080} |
| 33 | - OMP_NUM_THREADS=${OMP_NUM_THREADS:-32} |
| 34 | - MOJOLLAMA_BENCHMARK=${MOJOLLAMA_BENCHMARK:-false} |
| 35 | - MOJOLLAMA_BACKEND=${MOJOLLAMA_BACKEND:-auto} |
| 36 | healthcheck: |
| 37 | test: ["CMD", "curl", "-sf", "http://localhost:8080/health"] |
| 38 | interval: 30s |
| 39 | timeout: 5s |
| 40 | start_period: 60s |
| 41 | retries: 3 |
| 42 | restart: unless-stopped |
| 43 | ulimits: |
| 44 | memlock: -1 # required by llama-server --mlock |
| 45 | |
| 46 | services: |
| 47 | # ── CPU: TurboEngine AVX2 + llama.cpp CPU ────────────────────────────── |
| 48 | cpu: |
| 49 | <<: *common |
| 50 | build: |
| 51 | context: . |
| 52 | dockerfile: Dockerfile |
| 53 | image: ghcr.io/a730/mojollama:cpu |
| 54 | deploy: |
| 55 | resources: |
| 56 | limits: |
| 57 | cpus: "${CPU_LIMIT:-32}" |
| 58 | memory: "${MEM_LIMIT:-64G}" |
| 59 | |
| 60 | # ── CUDA: NVIDIA GPU + MAX backend ───────────────────────────────────── |
| 61 | cuda: |
| 62 | <<: *common |
| 63 | build: |
| 64 | context: . |
| 65 | dockerfile: docker/Dockerfile.cuda |
| 66 | image: ghcr.io/a730/mojollama:cuda |
| 67 | environment: |
| 68 | - MODEL_PATH=${MODEL_PATH:-/models/tinyllama-1.1b.Q4_K_M.gguf} |
| 69 | - PORT=${PORT:-8080} |
| 70 | - OMP_NUM_THREADS=${OMP_NUM_THREADS:-32} |
| 71 | - MOJOLLAMA_BENCHMARK=${MOJOLLAMA_BENCHMARK:-false} |
| 72 | - MOJOLLAMA_BACKEND=${MOJOLLAMA_BACKEND:-auto} |
| 73 | deploy: |
| 74 | resources: |
| 75 | reservations: |
| 76 | devices: |
| 77 | - driver: nvidia |
| 78 | count: all |
| 79 | capabilities: [gpu] |
| 80 | |
| 81 | # ── ROCm: AMD GPU + MAX backend ──────────────────────────────────────── |
| 82 | rocm: |
| 83 | <<: *common |
| 84 | build: |
| 85 | context: . |
| 86 | dockerfile: docker/Dockerfile.rocm |
| 87 | image: ghcr.io/a730/mojollama:rocm |
| 88 | environment: |
| 89 | - MODEL_PATH=${MODEL_PATH:-/models/tinyllama-1.1b.Q4_K_M.gguf} |
| 90 | - PORT=${PORT:-8080} |
| 91 | - OMP_NUM_THREADS=${OMP_NUM_THREADS:-32} |
| 92 | - MOJOLLAMA_BENCHMARK=${MOJOLLAMA_BENCHMARK:-false} |
| 93 | - MOJOLLAMA_BACKEND=${MOJOLLAMA_BACKEND:-auto} |
| 94 | devices: |
| 95 | - /dev/kfd:/dev/kfd |
| 96 | - /dev/dri:/dev/dri |
| 97 | group_add: |
| 98 | - video |
| 99 | |
| 100 | # ── Vulkan: Universal GPU (any GPU with Vulkan driver) ───────────────── |
| 101 | vulkan: |
| 102 | <<: *common |
| 103 | build: |
| 104 | context: . |
| 105 | dockerfile: docker/Dockerfile.vulkan |
| 106 | image: ghcr.io/a730/mojollama:vulkan |
| 107 | devices: |
| 108 | - /dev/dri:/dev/dri |
| 109 | |
| 110 | # ── SYCL: Intel GPU (oneAPI) ─────────────────────────────────────────── |
| 111 | sycl: |
| 112 | <<: *common |
| 113 | build: |
| 114 | context: . |
| 115 | dockerfile: docker/Dockerfile.sycl |
| 116 | image: ghcr.io/a730/mojollama:sycl |
| 117 | devices: |
| 118 | - /dev/dri:/dev/dri |
| 119 | group_add: |
| 120 | - render |
| 121 | - video |
| 122 | |
| 123 | volumes: |
| 124 | mojollama-config: |
| 125 | name: mojollama-config |