WACATW commited on
Commit
d7e461a
·
verified ·
1 Parent(s): df0e2cd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -2
Dockerfile CHANGED
@@ -11,9 +11,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
11
  build-essential \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # 安装 Python 依赖
15
  COPY requirements.txt /tmp/requirements.txt
16
- RUN pip3 install --no-cache-dir -r /tmp/requirements.txt
 
 
 
 
 
17
 
18
  # 创建目录
19
  RUN mkdir -p /home/coder/workspace /app/static /usr/share/nginx/html
 
11
  build-essential \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # 用 venv 安装 Python 依赖,绕过 PEP 668
15
  COPY requirements.txt /tmp/requirements.txt
16
+ RUN python3 -m venv /opt/venv && \
17
+ /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \
18
+ /opt/venv/bin/pip install --no-cache-dir -r /tmp/requirements.txt
19
+
20
+ # 让 uvicorn 等命令默认走 venv
21
+ ENV PATH="/opt/venv/bin:$PATH"
22
 
23
  # 创建目录
24
  RUN mkdir -p /home/coder/workspace /app/static /usr/share/nginx/html