chore: init monorepo snapshot
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
ollama:
|
||||
image: ollama/ollama:0.4.2
|
||||
container_name: aimnote-ollama
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${OLLAMA_PORT:-11434}:11434"
|
||||
volumes:
|
||||
- ollama_data:/root/.ollama
|
||||
environment:
|
||||
# 为了让模型常驻内存,否则频繁调度时会被逐出
|
||||
- OLLAMA_KEEP_ALIVE=${OLLAMA_KEEP_ALIVE:-24h}
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://127.0.0.1:11434/api/version"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- capabilities: ["gpu"]
|
||||
count: "${OLLAMA_GPU_COUNT:-0}"
|
||||
limits:
|
||||
cpus: "${OLLAMA_CPU_LIMIT:-4}"
|
||||
memory: "${OLLAMA_MEMORY_LIMIT:-16g}"
|
||||
|
||||
ollama-model-init:
|
||||
image: curlimages/curl:8.11.1
|
||||
container_name: aimnote-ollama-init
|
||||
depends_on:
|
||||
ollama:
|
||||
condition: service_started
|
||||
restart: "no"
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
# 通过 OpenAI 兼容 API 主动预拉取 qwen3-embedding 与 qwen2.5
|
||||
command: |
|
||||
until curl -fsS http://ollama:11434/api/version >/dev/null 2>&1; do
|
||||
echo "等待 Ollama 服务启动..."
|
||||
sleep 2
|
||||
done
|
||||
for model in "qwen3-embedding:8b" "qwen2.5:14b"; do
|
||||
echo "准备拉取 $model"
|
||||
curl -fsS -X POST http://ollama:11434/api/pull \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"name\":\"$model\"}" || exit 1
|
||||
done
|
||||
echo "模型拉取完成"
|
||||
|
||||
volumes:
|
||||
ollama_data:
|
||||
driver: local
|
||||
Reference in New Issue
Block a user