-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
58 lines (55 loc) · 2.53 KB
/
docker-compose.yml
File metadata and controls
58 lines (55 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# GigaAM ASR — deployment via Docker Compose (self-hosted: Linux server / NAS / mini-PC).
#
# Run: `docker compose up -d --build` (a container-management UI works too). Before starting:
# 1) Create a `.env` file alongside (see .env.example) and set API_KEY.
# 2) Create the ./models directory and make UID 1000 its owner (chown 1000:1000 ./models),
# otherwise non-root in the container cannot write weights there. See README → "Deployment (Docker Compose)".
# The first start downloads the GigaAM weights into ./models (minutes) → then the healthcheck becomes healthy.
services:
gigaam-api:
build:
context: .
dockerfile: Dockerfile
image: gigaam-api:latest
container_name: gigaam-api
# required: false → without .env the service starts on defaults (config.py); for production
# create .env (see .env.example) and set API_KEY — it is picked up automatically.
env_file:
- path: .env
required: false
ports:
- "8000:8000"
volumes:
# The weights cache survives container re-creation; the first start downloads the weights here.
- ./models:/data/models
restart: unless-stopped
healthcheck:
# Without curl (absent in slim) — stdlib urllib, exec-form CMD. start_period is generous for
# the weights download on the first start: until they load uvicorn does not respond yet.
test: ["CMD", "python", "-c", "import sys, urllib.request; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=5).status == 200 else 1)"]
interval: 30s
timeout: 10s
retries: 5
start_period: 600s
# --- Resource limits (a typical self-hosted host: ~4 cores / 8 GB) ---
# Tune to your hardware. The top-level mem_limit/cpus work more reliably
# (Compose specification v2) than deploy.resources (Swarm). Uncomment if needed:
# mem_limit: 6g
# cpus: 4.0
# Keep NUM_THREADS in .env ≤ the number of allocated cores (torch.set_num_threads).
# --- Optional weights warm-up (does NOT start with `up`; only via the `tools` profile) ---
# Pre-download the weights into ./models without bringing up the HTTP service (useful for a slow/offline
# host). Run: docker compose --profile tools run --rm download-weights
download-weights:
build:
context: .
dockerfile: Dockerfile
image: gigaam-api:latest
profiles: ["tools"]
env_file:
- path: .env
required: false
volumes:
- ./models:/data/models
command: ["python", "-m", "gigaam_api.download_weights"]
restart: "no"