fryefeng commited on
Commit
eeb1a9f
·
verified ·
1 Parent(s): 9d4e99d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -3
Dockerfile CHANGED
@@ -21,7 +21,9 @@ EXPOSE 8000
21
 
22
  # 7. 使用 uv 安装依赖(适配基础镜像,替代 pip)
23
  # --no-cache-dir 进一步减少缓存文件,缩小镜像体积
24
- RUN uv pip install --no-cache-dir -r requirements.txt
 
 
25
 
26
- # 9. 启动命令
27
- CMD ["python", "server.py"]
 
21
 
22
  # 7. 使用 uv 安装依赖(适配基础镜像,替代 pip)
23
  # --no-cache-dir 进一步减少缓存文件,缩小镜像体积
24
+ RUN uv venv && \
25
+ . .venv/bin/activate && \
26
+ uv pip install --no-cache-dir -r requirements.txt
27
 
28
+ # 启动时先激活虚拟环境,再运行应用
29
+ CMD ["/bin/sh", "-c", ". .venv/bin/activate && python server.py"]