79 lines
2.3 KiB
YAML
79 lines
2.3 KiB
YAML
services:
|
|
llama:
|
|
image: ghcr.io/ggml-org/llama.cpp:server
|
|
container_name: llama
|
|
restart: unless-stopped
|
|
|
|
# --- run as unprivileged, no escalation ---
|
|
user: "1000:1000"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:size=512m
|
|
|
|
# --- resource ceiling: leave headroom for the other 18 stacks ---
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "4.0"
|
|
memory: 4g
|
|
reservations:
|
|
memory: 2g
|
|
|
|
# --- model mounted read-only, downloaded out-of-band (see notes below) ---
|
|
volumes:
|
|
- /srv/docker/llama/models:/models:ro
|
|
|
|
command: >
|
|
-m /models/phi-4-mini-instruct-Q4_K_M.gguf
|
|
--host 0.0.0.0
|
|
--port 8091
|
|
--ctx-size 4096
|
|
--threads 4
|
|
--threads-batch 4
|
|
-np 1
|
|
--api-key ${LLAMA_API_KEY}
|
|
|
|
networks:
|
|
- llama
|
|
- traefik_network
|
|
|
|
labels:
|
|
### Auto create icon on Flame dashboard
|
|
- flame.type=application
|
|
- flame.name=${SERVICE_NAME}
|
|
- flame.url=https://${SERVICE_NAME}.${DOMAIN_NAME}
|
|
- flame.icon=https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/ollama.png
|
|
### Traefik Labels
|
|
- traefik.enable=true
|
|
- traefik.docker.network=traefik_network
|
|
- traefik.http.routers.${SERVICE_NAME}-https.tls=true
|
|
- traefik.http.routers.${SERVICE_NAME}-https.tls.certresolver=cloudflare
|
|
- traefik.http.routers.${SERVICE_NAME}-https.entrypoints=websecure
|
|
- traefik.http.routers.${SERVICE_NAME}-https.rule=Host(`${SERVICE_NAME}.${DOMAIN_NAME}`)
|
|
- traefik.http.services.${SERVICE_NAME}.loadbalancer.server.port=8091
|
|
### Monitor with uptime-kuma
|
|
- kuma.monitoring.group.name=Docker Containers
|
|
- kuma.${SERVICE_NAME}.docker.parent_name=monitoring
|
|
- kuma.${SERVICE_NAME}.docker.name=${SERVICE_NAME}
|
|
- kuma.${SERVICE_NAME}.docker.type=docker
|
|
- kuma.${SERVICE_NAME}.docker.docker_container=${SERVICE_NAME}
|
|
- kuma.${SERVICE_NAME}.docker.docker_host=1
|
|
- 'kuma.${SERVICE_NAME}.docker.tag_names=[{"name": "docker_tag"}]'
|
|
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8091/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
networks:
|
|
traefik_network:
|
|
external: true
|
|
llama:
|
|
name: llama_internal
|
|
driver: bridge
|
|
internal: true |