Selaa lähdekoodia

v0.0.3-milvus全文检索依赖跟新
- 更新docerfile,使用uv 安装环境依赖

WangXuMing 2 kuukautta sitten
vanhempi
sitoutus
8460e15e6f
3 muutettua tiedostoa jossa 14 lisäystä ja 13 poistoa
  1. 14 13
      Dockerfile
  2. 0 0
      foundation/ai/rag/retrieval/bm25.py
  3. BIN
      requirements.txt

+ 14 - 13
Dockerfile

@@ -1,30 +1,31 @@
 FROM python:3.12-slim
 
+# 环境变量配置
 ENV DEBIAN_FRONTEND=noninteractive \
     TZ=Asia/Shanghai
 
-# 安装系统依赖包并创建虚拟环境
-RUN chmod 777 /tmp \
-    && python -m venv /venv
+# 创建虚拟环境(无多余注释,换行仅用 \ 连接)
+RUN chmod 777 /tmp && python -m venv /venv
 
+# 配置虚拟环境 PATH
 ENV PATH="/venv/bin:$PATH"
 
-# 先复制 requirements 文件安装依赖(利用缓存)
+# 复制依赖文件
 COPY requirements.txt /tmp/
-RUN /venv/bin/pip config set global.index-url https://mirrors.aliyun.com/pypi/simple \
-    && /venv/bin/pip config set install.trusted-host mirrors.aliyun.com \
-    && /venv/bin/pip --default-timeout=1800 install -r /tmp/requirements.txt \
-    && rm -rf /root/.cache
 
-# 设置工作目录并复制项目文件
+# 关键:用 uv 安装依赖(一行命令拆分行,仅用 \ 连接,无任何行首注释)
+RUN /venv/bin/pip install --no-cache-dir uv \
+    && /venv/bin/uv config set global.index-url https://mirrors.aliyun.com/pypi/simple \
+    && /venv/bin/uv config set global.trusted-host mirrors.aliyun.com \
+    && /venv/bin/uv pip install --no-cache --timeout 1800 -r /tmp/requirements.txt \
+    && rm -rf /root/.cache /tmp/requirements.txt
+
+# 项目部署
 WORKDIR /app
 COPY . /app
 
 EXPOSE 8001
-# 确保脚本可执行
 RUN chmod 777 run.sh
 
-# 使用虚拟环境运行脚本
-#CMD ["/venv/bin/gunicorn", "-c", "gunicorn_config.py", "server.app:app"]
-# 带参数的启动方式
+# 启动命令
 CMD ["/venv/bin/python", "server/app.py", "--host", "0.0.0.0", "--port", "8001"]

+ 0 - 0
foundation/ai/rag/retrieval/bm25.py


BIN
requirements.txt