feat: add Docker support for containerized deployment

This commit is contained in:
赵杰 Jie Zhao (雄狮汽车科技)
2025-11-02 23:55:54 +08:00
parent cad03268f3
commit 2ab6aafc6f
6 changed files with 424 additions and 0 deletions

32
docker-compose.yml Normal file
View File

@@ -0,0 +1,32 @@
version: '3.8'
services:
web:
build:
context: .
dockerfile: Dockerfile
container_name: diet_recommendation_app
ports:
- "5000:5000"
environment:
- FLASK_ENV=production
- PYTHONUNBUFFERED=1
volumes:
# 持久化数据目录
- ./data:/app/data
- ./logs:/app/logs
- ./models:/app/models
restart: unless-stopped
networks:
- app-network
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:5000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
app-network:
driver: bridge