anfastech commited on
Commit
227215d
·
1 Parent(s): 77b1e5b

fix: resolve torch security error by pinning torch 2.6.0 and updating requirements

Browse files
Files changed (2) hide show
  1. Dockerfile +9 -9
  2. requirements.txt +7 -5
Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM python:3.10
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  libffi-dev \
8
  libsndfile1 \
@@ -10,21 +10,21 @@ RUN apt-get update && apt-get install -y \
10
  libxt6 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Copy requirements first to leverage Docker cache
14
  COPY requirements.txt .
15
 
16
- # Install PyTorch and torchaudio first (CPU version)
17
- RUN pip install --no-cache-dir torch==2.5.1 torchvision==0.20.1 torchaudio --index-url https://download.pytorch.org/whl/cu121
18
 
19
- # Install the rest of requirements
20
- RUN pip install --no-cache-dir -r requirements.txt
 
 
21
 
22
- # Copy application files
23
  COPY . .
24
 
25
  EXPOSE 7860
26
-
27
  ENV PYTHONUNBUFFERED=1
28
 
29
- # Run the application
30
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # System dependencies
6
  RUN apt-get update && apt-get install -y \
7
  libffi-dev \
8
  libsndfile1 \
 
10
  libxt6 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy requirements
14
  COPY requirements.txt .
15
 
16
+ # Upgrade pip
17
+ RUN python -m pip install --upgrade pip
18
 
19
+ # Install all Python dependencies including torch
20
+ RUN pip install --no-cache-dir \
21
+ -r requirements.txt \
22
+ -f https://download.pytorch.org/whl/cpu/torch_stable.html
23
 
24
+ # Copy app code
25
  COPY . .
26
 
27
  EXPOSE 7860
 
28
  ENV PYTHONUNBUFFERED=1
29
 
 
30
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
requirements.txt CHANGED
@@ -2,11 +2,13 @@
2
  numpy>=1.24.0,<2.0.0
3
  librosa>=0.10.0
4
  transformers>=4.38.0,<5.0
5
- # torch and torchaudio are to be installed separately according to the system configuration.
6
- # torch==2.0.1
7
- # torchaudio==2.0.2
8
 
9
- # Audio
 
 
 
 
10
  soundfile>=0.12.1
11
  scipy>=1.11.0
12
  praat-parselmouth>=0.4.3
@@ -22,4 +24,4 @@ python-multipart>=0.0.18
22
  python-json-logger>=2.0.0
23
 
24
  # Web UI
25
- gradio==6.1.0
 
2
  numpy>=1.24.0,<2.0.0
3
  librosa>=0.10.0
4
  transformers>=4.38.0,<5.0
5
+ typing-extensions>=4.10.0
 
 
6
 
7
+ # Torch pinned for CVE-2025-32434 compliance
8
+ torch==2.6.0+cpu
9
+ torchaudio==2.6.0+cpu
10
+
11
+ # Audio processing
12
  soundfile>=0.12.1
13
  scipy>=1.11.0
14
  praat-parselmouth>=0.4.3
 
24
  python-json-logger>=2.0.0
25
 
26
  # Web UI
27
+ gradio==6.1.0