From 1d714d443eede8895f8a8cfe590a1728f61a8824 Mon Sep 17 00:00:00 2001 From: Doiiars Date: Thu, 30 Oct 2025 14:13:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=BD=BF=E7=94=A8uv=E5=AE=89?= =?UTF-8?q?=E8=A3=85=EF=BC=8C=E6=9B=B4=E5=8A=A0=E5=BF=AB=E9=80=9F=EF=BC=8C?= =?UTF-8?q?=E4=B8=94=E4=BF=AE=E5=A4=8Dtorch=E5=92=8Ctransformers=E6=9C=AA?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 改为使用uv安装,更加快速,且修复torch和transformers未安装的问题 --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1d770be..4788bc0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,12 +34,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ && apt-get clean && rm -rf /var/lib/apt/lists/* +# Install uv and expose it on PATH +ENV PATH="/root/.local/bin:${PATH}" +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + WORKDIR /app # Install Python dependencies first to leverage Docker layer caching COPY requirements.txt ./ -RUN pip install --upgrade pip && \ - pip install -r requirements.txt && \ +RUN uv pip install --system -r requirements.txt && \ + uv pip install --system torch torchvision torchaudio && \ + uv pip install --system transformers scikit-learn xgboost && \ python -m playwright install chromium # Copy application source