Browse Source

feat: 修复

zhangwl 2 months ago
parent
commit
181ff9b19f
1 changed files with 4 additions and 4 deletions
  1. 4 4
      Dockerfile

+ 4 - 4
Dockerfile

@@ -1,5 +1,5 @@
 # 多阶段构建 - 第一阶段:依赖安装
-FROM python:3.10-slim as builder
+FROM python:3.10 as builder
 
 WORKDIR /build
 
@@ -10,10 +10,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
 
 # 复制requirements并安装Python依赖
 COPY requirements.txt .
-RUN pip install --user --no-cache-dir -r requirements.txt
+RUN pip install --user --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple --default-timeout=100 -r requirements.txt
 
 # 第二阶段:运行时镜像
-FROM python:3.10-slim
+FROM python:3.10
 
 WORKDIR /app
 
@@ -42,4 +42,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
     CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/docs')" || exit 1
 
 # 启动应用
-CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2"]
+CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2"]