BirkhoffLee commited on
Commit
f8d66a3
·
unverified ·
1 Parent(s): 5d87fc8

fix: 使用指定虚拟环境的方式安装依赖

Browse files
Files changed (2) hide show
  1. Dockerfile +5 -4
  2. entrypoint.sh +1 -1
Dockerfile CHANGED
@@ -26,10 +26,11 @@ ENV PATH="/root/.local/bin:${PATH}" \
26
  # 安装 pdf2zh-next
27
  RUN uv tool install --python 3.12 pdf2zh-next
28
 
29
- # 安装网关依赖
30
- RUN uv pip install --python 3.12 --system \
31
- "fastapi>=0.115" "uvicorn[standard]>=0.32" "httpx>=0.28" \
32
- python-multipart bcrypt itsdangerous websockets
 
33
 
34
  # 复制网关和启动脚本
35
  COPY gateway.py /gateway.py
 
26
  # 安装 pdf2zh-next
27
  RUN uv tool install --python 3.12 pdf2zh-next
28
 
29
+ # 网关创建独立 venv 并安装依赖
30
+ RUN uv venv /opt/gateway --python 3.12 && \
31
+ uv pip install --python /opt/gateway/bin/python \
32
+ "fastapi>=0.115" "uvicorn[standard]>=0.32" "httpx>=0.28" \
33
+ python-multipart bcrypt itsdangerous websockets
34
 
35
  # 复制网关和启动脚本
36
  COPY gateway.py /gateway.py
entrypoint.sh CHANGED
@@ -19,7 +19,7 @@ pdf2zh_next --gui --server-port "${GRADIO_SERVER_PORT}" &
19
  PDF_PID=$!
20
 
21
  echo "[INFO] Starting gateway on :7860"
22
- cd / && uv run --python 3.12 --no-project python -m uvicorn gateway:app \
23
  --host 0.0.0.0 --port 7860 --log-level info &
24
  GW_PID=$!
25
 
 
19
  PDF_PID=$!
20
 
21
  echo "[INFO] Starting gateway on :7860"
22
+ cd / && /opt/gateway/bin/uvicorn gateway:app \
23
  --host 0.0.0.0 --port 7860 --log-level info &
24
  GW_PID=$!
25