mirror of
https://github.com/RYDE-WORK/lnp_ml.git
synced 2026-03-21 01:27:00 +08:00
55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
services:
|
|
# FastAPI 后端服务
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: api
|
|
container_name: lnp-api
|
|
environment:
|
|
- MODEL_PATH=/app/models/final/model.pt
|
|
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
|
|
deploy:
|
|
resources:
|
|
reservations:
|
|
devices:
|
|
- driver: nvidia
|
|
count: 1
|
|
capabilities: [gpu]
|
|
|
|
# Streamlit 前端服务
|
|
streamlit:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: streamlit
|
|
container_name: lnp-streamlit
|
|
ports:
|
|
- "18501: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
|