修改端口为7400

This commit is contained in:
2025-11-05 13:32:14 +08:00
parent 3a8a498648
commit d69d0158d8
9 changed files with 28 additions and 28 deletions

View File

@@ -46,7 +46,7 @@ docker build -t diet-recommendation-app .
# 运行容器
docker run -d \
--name diet_recommendation_app \
-p 5000:5000 \
-p 7400:7400 \
-v $(pwd)/data:/app/data \
-v $(pwd)/logs:/app/logs \
-v $(pwd)/models:/app/models \
@@ -63,12 +63,12 @@ docker rm diet_recommendation_app
## 🌐 访问应用
容器启动后,访问:
- **主页**: http://localhost:5000
- **背诵排序**: http://localhost:5000/recitation
- **数据采集**: http://localhost:5000/data-collection
- **智能推荐**: http://localhost:5000/recommendation
- **营养分析**: http://localhost:5000/analysis
- **健康检查**: http://localhost:5000/health
- **主页**: http://localhost:7400
- **背诵排序**: http://localhost:7400/recitation
- **数据采集**: http://localhost:7400/data-collection
- **智能推荐**: http://localhost:7400/recommendation
- **营养分析**: http://localhost:7400/analysis
- **健康检查**: http://localhost:7400/health
## 📁 数据持久化
@@ -92,11 +92,11 @@ environment:
### 端口配置
默认端口为 `5000`,如需修改:
默认端口为 `7400`,如需修改:
```yaml
ports:
- "8080:5000" # 将主机的8080端口映射到容器的5000端口
- "8080:7400" # 将主机的8080端口映射到容器的7400端口
```
## 🐛 故障排除
@@ -153,7 +153,7 @@ docker-compose ps
docker ps
```
健康检查端点:`http://localhost:5000/health`
健康检查端点:`http://localhost:7400/health`
## 🔒 安全建议
@@ -177,7 +177,7 @@ server {
server_name your-domain.com;
location / {
proxy_pass http://localhost:5000;
proxy_pass http://localhost:7400;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -246,7 +246,7 @@ services:
- 标准版默认 2 个 worker适合 1GB+ 内存)
- 小内存机器可以在 `Dockerfile` 中修改为 1 个 worker
```dockerfile
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "1", ...]
CMD ["python", "-m", "gunicorn", "--bind", "0.0.0.0:7400", "--workers", "1", ...]
```
4. **文件权限**:确保挂载的目录有适当的读写权限