完全对齐模板:修正所有细节差异

- 修正 Bearer token 解析:添加空格检查(Bearer 后必须有空格)
- 修正 run_api_server.py:添加启动信息打印,格式与模板一致
- 修正 Dockerfile:添加 PYTHONDONTWRITEBYTECODE 环境变量
- 修正 Dockerfile HEALTHCHECK:添加 start-period 和 retries 参数
- 修正 requirements.txt:添加注释分组,与模板格式一致
This commit is contained in:
zhanggangyong
2026-01-24 09:13:15 +00:00
parent 746535bd83
commit d89edd3e74
4 changed files with 25 additions and 5 deletions
+8 -1
View File
@@ -1,10 +1,17 @@
FROM python:3.12-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
RUN apt-get update && apt-get install -y gcc curl && rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s CMD curl -f http://localhost:8000/health || exit 1
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
CMD ["python", "run_api_server.py"]