lnp_ml/docker-compose.yml
2026-02-11 16:49:28 +08:00

50 lines
1.1 KiB
YAML

services:
# FastAPI 后端服务
api:
build:
context: .
dockerfile: Dockerfile
target: api
container_name: lnp-api
environment:
- MODEL_PATH=/app/models/final/model.pt
- DEVICE=cpu
volumes:
# 挂载模型目录以便更新模型
- ./models/final:/app/models/final:ro
- ./models/mpnn:/app/models/mpnn:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Streamlit 前端服务
streamlit:
build:
context: .
dockerfile: Dockerfile
target: streamlit
container_name: lnp-streamlit
ports:
- "8501:8501"
environment:
- API_URL=http://api:8000
depends_on:
api:
condition: service_started
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8501/_stcore/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
default:
name: lnp-network