23 lines
939 B
YAML
23 lines
939 B
YAML
services:
|
|
oral-trainer-api:
|
|
build:
|
|
context: ..
|
|
dockerfile: sentence_api/Dockerfile
|
|
args:
|
|
PYTHON_IMAGE: ${PYTHON_IMAGE:-docker.m.daocloud.io/library/python:3.12-slim}
|
|
APT_MIRROR: ${APT_MIRROR:-mirrors.aliyun.com}
|
|
PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.tuna.tsinghua.edu.cn/simple}
|
|
PIP_TRUSTED_HOST: ${PIP_TRUSTED_HOST:-pypi.tuna.tsinghua.edu.cn}
|
|
restart: unless-stopped
|
|
network_mode: host
|
|
env_file:
|
|
- .env
|
|
command: ["python", "-m", "uvicorn", "sentence_api.main:app", "--host", "${ORAL_TRAINER_BIND_HOST:-127.0.0.1}", "--port", "8000", "--workers", "1", "--proxy-headers", "--forwarded-allow-ips", "*"]
|
|
volumes:
|
|
- ./data:/app/sentence_api/data
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/healthz', timeout=5)"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|