提高内存进程使用

This commit is contained in:
lhx
2025-11-29 16:02:57 +08:00
parent ae476256a9
commit dd73a4518b
2 changed files with 25 additions and 3 deletions

View File

@@ -29,5 +29,8 @@ RUN mkdir -p /app/logs && chmod 755 /app/logs
# 暴露端口
EXPOSE 8000
# 启动命令,启用详细日志
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--access-log", "--log-level", "info"]
# 安装gunicorn
RUN pip install --no-cache-dir gunicorn==21.2.0
# 启动命令使用gunicorn4个workers
CMD ["gunicorn", "app.main:app", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--timeout", "120", "--keepalive", "5"]