Akash4911 commited on
Commit
2c4fc7a
Β·
1 Parent(s): e275401

Critical Fix: Slim requirements and clean Dockerfile to fix HF disk space issue

Browse files
Files changed (2) hide show
  1. Dockerfile +15 -36
  2. requirements.txt +27 -15
Dockerfile CHANGED
@@ -1,16 +1,16 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.10-slim
3
 
4
  ENV PYTHONUNBUFFERED=1 \
5
  PYTHONUTF8=1 \
6
  PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
7
- FAKESHIELD_SKIP_WARMUP=0
 
8
 
9
  WORKDIR /app
10
 
11
- RUN apt-get update && apt-get install -y \
 
12
  build-essential \
13
- cmake \
14
  libgl1-mesa-glx \
15
  libglib2.0-0 \
16
  libsndfile1 \
@@ -18,38 +18,17 @@ RUN apt-get update && apt-get install -y \
18
  libmagic1 \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
- RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
22
-
23
- RUN pip install --no-cache-dir 'fastapi'
24
- RUN pip install --no-cache-dir 'uvicorn[standard]'
25
- RUN pip install --no-cache-dir 'transformers'
26
- RUN pip install --no-cache-dir 'numpy'
27
- RUN pip install --no-cache-dir 'scipy'
28
- RUN pip install --no-cache-dir 'optimum[onnxruntime]'
29
- RUN pip install --no-cache-dir 'onnxruntime'
30
- RUN pip install --no-cache-dir 'python-multipart'
31
- RUN pip install --no-cache-dir 'pydantic'
32
- RUN pip install --no-cache-dir 'python-dotenv'
33
- RUN pip install --no-cache-dir 'accelerate'
34
- RUN pip install --no-cache-dir 'sentence-transformers'
35
- RUN pip install --no-cache-dir 'scikit-learn'
36
- RUN pip install --no-cache-dir 'Pillow'
37
- RUN pip install --no-cache-dir 'piexif'
38
- RUN pip install --no-cache-dir 'opencv-python-headless'
39
- RUN pip install --no-cache-dir 'diffusers'
40
- RUN pip install --no-cache-dir 'librosa>=0.10.0'
41
- RUN pip install --no-cache-dir 'soundfile>=0.12.0'
42
- RUN pip install --no-cache-dir 'scipy>=1.12.0'
43
- RUN pip install --no-cache-dir 'resampy>=0.4.2'
44
- RUN pip install --no-cache-dir 'pyannote.audio>=3.1.0'
45
- RUN pip install --no-cache-dir 'mediapipe'
46
- RUN pip install --no-cache-dir 'protobuf~=4.25.3'
47
- RUN pip install --no-cache-dir 'motor'
48
- RUN pip install --no-cache-dir 'pydantic-settings'
49
- RUN pip install --no-cache-dir 'google-generativeai'
50
- RUN pip install --no-cache-dir 'c2pa-python'
51
- RUN pip install --no-cache-dir 'python-magic; platform_system != 'Windows''
52
- RUN pip install --no-cache-dir 'python-magic-bin; platform_system == 'Windows''
53
  COPY . .
 
54
  EXPOSE 7860
 
55
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.10-slim
2
 
3
  ENV PYTHONUNBUFFERED=1 \
4
  PYTHONUTF8=1 \
5
  PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
6
+ FAKESHIELD_SKIP_WARMUP=0 \
7
+ HF_HUB_DISABLE_SYMLINKS_WARNING=1
8
 
9
  WORKDIR /app
10
 
11
+ # System dependencies
12
+ RUN apt-get update && apt-get install -y --no-install-recommends \
13
  build-essential \
 
14
  libgl1-mesa-glx \
15
  libglib2.0-0 \
16
  libsndfile1 \
 
18
  libmagic1 \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
+ COPY requirements.txt .
22
+
23
+ # Install PyTorch CPU-only first (saves ~1.5GB vs full package)
24
+ RUN pip install --no-cache-dir --upgrade pip && \
25
+ pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu
26
+
27
+ # Install all remaining requirements
28
+ RUN pip install --no-cache-dir -r requirements.txt
29
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  COPY . .
31
+
32
  EXPOSE 7860
33
+
34
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
requirements.txt CHANGED
@@ -1,31 +1,43 @@
 
1
  fastapi
2
  uvicorn[standard]
3
- # HF Deployment Marker
4
- transformers
5
- numpy
6
- scipy
7
- optimum[onnxruntime]
8
- onnxruntime
9
  python-multipart
10
- pydantic
11
  python-dotenv
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  accelerate
13
  sentence-transformers
14
  scikit-learn
 
 
 
 
15
  Pillow
16
  piexif
17
  opencv-python-headless
18
- diffusers
 
 
19
  librosa>=0.10.0
20
  soundfile>=0.12.0
21
- scipy>=1.12.0
22
  resampy>=0.4.2
23
  pyannote.audio>=3.1.0
24
- mediapipe
25
- protobuf~=4.25.3
26
- motor
27
- pydantic-settings
28
  google-generativeai
29
- c2pa-python
30
- python-magic; platform_system != 'Windows'
 
31
  python-magic-bin; platform_system == 'Windows'
 
 
1
+ # ── Core Web Framework ─────────────────────────────────────────────
2
  fastapi
3
  uvicorn[standard]
 
 
 
 
 
 
4
  python-multipart
 
5
  python-dotenv
6
+ pydantic
7
+ pydantic-settings
8
+
9
+ # ── Database ────────────────────────────────────────────────────────
10
+ motor
11
+
12
+ # ── Auth ────────────────────────────────────────────────────────────
13
+ passlib[bcrypt]
14
+ PyJWT
15
+
16
+ # ── AI / ML Core ────────────────────────────────────────────────────
17
+ torch
18
+ transformers
19
  accelerate
20
  sentence-transformers
21
  scikit-learn
22
+ numpy
23
+ scipy
24
+
25
+ # ── Image Processing ────────────────────────────────────────────────
26
  Pillow
27
  piexif
28
  opencv-python-headless
29
+ c2pa-python
30
+
31
+ # ── Audio Processing ────────────────────────────────────────────────
32
  librosa>=0.10.0
33
  soundfile>=0.12.0
 
34
  resampy>=0.4.2
35
  pyannote.audio>=3.1.0
36
+
37
+ # ── Gemini AI ───────────────────────────────────────────────────────
 
 
38
  google-generativeai
39
+
40
+ # ── Misc ────────────────────────────────────────────────────────────
41
+ protobuf~=4.25.3
42
  python-magic-bin; platform_system == 'Windows'
43
+ python-magic; platform_system != 'Windows'