Committed by
BaiFu
改为使用uv安装,更加快速,且修复torch和transformers未安装的问题
改为使用uv安装,更加快速,且修复torch和transformers未安装的问题
Showing
1 changed file
with
7 additions
and
2 deletions
| @@ -34,12 +34,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ | @@ -34,12 +34,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| 34 | ffmpeg \ | 34 | ffmpeg \ |
| 35 | && apt-get clean && rm -rf /var/lib/apt/lists/* | 35 | && apt-get clean && rm -rf /var/lib/apt/lists/* |
| 36 | 36 | ||
| 37 | +# Install uv and expose it on PATH | ||
| 38 | +ENV PATH="/root/.local/bin:${PATH}" | ||
| 39 | +RUN curl -LsSf https://astral.sh/uv/install.sh | sh | ||
| 40 | + | ||
| 37 | WORKDIR /app | 41 | WORKDIR /app |
| 38 | 42 | ||
| 39 | # Install Python dependencies first to leverage Docker layer caching | 43 | # Install Python dependencies first to leverage Docker layer caching |
| 40 | COPY requirements.txt ./ | 44 | COPY requirements.txt ./ |
| 41 | -RUN pip install --upgrade pip && \ | ||
| 42 | - pip install -r requirements.txt && \ | 45 | +RUN uv pip install --system -r requirements.txt && \ |
| 46 | + uv pip install --system torch torchvision torchaudio && \ | ||
| 47 | + uv pip install --system transformers scikit-learn xgboost && \ | ||
| 43 | python -m playwright install chromium | 48 | python -m playwright install chromium |
| 44 | 49 | ||
| 45 | # Copy application source | 50 | # Copy application source |
-
Please register or login to post a comment