fix: 使用指定虚拟环境的方式安装依赖
Browse files- Dockerfile +5 -4
- 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
|
| 31 |
-
|
| 32 |
-
|
|
|
|
| 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 / &&
|
| 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 |
|