ekjotsingh1 commited on
Commit
dccf332
·
verified ·
1 Parent(s): 1828d2a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -21
Dockerfile CHANGED
@@ -4,38 +4,47 @@ FROM python:3.10-slim
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # 1. Install System Dependencies
8
  RUN apt-get update && apt-get install -y \
9
  libgl1 \
10
  libglib2.0-0 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # 2. Upgrade Pip
14
- RUN pip install --no-cache-dir --upgrade pip
15
 
16
- # 3. Install Numpy ALONE (Layer 1)
17
- # We force binary install to prevent compilation spikes
18
- RUN pip install --no-cache-dir --only-binary=:all: numpy==1.26.4
19
 
20
- # 4. Install Core Deps (Layer 2)
21
- RUN pip install --no-cache-dir --only-binary=:all: \
22
- pillow<11.0 \
23
- huggingface_hub==0.23.0 \
24
- cryptography==42.0.5
25
 
26
- # 5. Install Gradio (Layer 3)
27
- # Installing it last ensures dependencies are already met
28
- RUN pip install --no-cache-dir --only-binary=:all: gradio==4.44.0
29
 
30
- # 6. Install Llama Wheel (Layer 4)
31
- RUN pip install --no-cache-dir https://github.com/mrzeeshanahmed/llama-cpp-python/releases/download/v0.3.17-manylinux-x86_64/llama_cpp_python-0.3.17-cp310-cp310-linux_x86_64.whl
32
 
33
- # 7. Copy App Code
34
- COPY . .
 
 
 
 
 
 
 
 
 
 
35
 
36
- # 8. Configure Network
 
 
 
 
 
37
  ENV GRADIO_SERVER_NAME="0.0.0.0"
38
  EXPOSE 7860
39
-
40
- # 9. Launch
41
  CMD ["python", "app.py"]
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # 1. Install System Dependencies (Minimal)
8
  RUN apt-get update && apt-get install -y \
9
  libgl1 \
10
  libglib2.0-0 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # 2. Install 'uv' (The High-Speed Installer)
14
+ RUN pip install uv
15
 
16
+ # --- THE IRONCLAD INSTALLATION SEQUENCE ---
17
+ # We install dependencies ONE BY ONE to prevent Memory/CPU spikes.
18
+ # If one step fails, you don't lose the progress of the others.
19
 
20
+ # Step A: Numpy (The Foundation) - Memory Heavy
21
+ RUN uv pip install --system --no-cache numpy==1.26.4
 
 
 
22
 
23
+ # Step B: Pillow (Image Processing)
24
+ RUN uv pip install --system --no-cache "pillow<11.0"
 
25
 
26
+ # Step C: Cryptography (Security)
27
+ RUN uv pip install --system --no-cache cryptography==42.0.5
28
 
29
+ # Step D: Hugging Face Hub (Network)
30
+ RUN uv pip install --system --no-cache huggingface_hub==0.23.0
31
+
32
+ # Step E: Matplotlib (Data Viz - Required by Gradio)
33
+ RUN uv pip install --system --no-cache "matplotlib<4.0"
34
+
35
+ # Step F: Pandas (Data - Required by Gradio)
36
+ RUN uv pip install --system --no-cache "pandas<3.0"
37
+
38
+ # Step G: Gradio (The Interface)
39
+ # Since dependencies are already installed above, this will be light.
40
+ RUN uv pip install --system --no-cache gradio==4.44.0
41
 
42
+ # Step H: Llama CPP (The Engine)
43
+ # Using the Pre-Compiled Custom Wheel for Debian/CPU
44
+ RUN uv pip install --system --no-cache https://github.com/mrzeeshanahmed/llama-cpp-python/releases/download/v0.3.17-manylinux-x86_64/llama_cpp_python-0.3.17-cp310-cp310-linux_x86_64.whl
45
+
46
+ # --- FINAL SETUP ---
47
+ COPY . .
48
  ENV GRADIO_SERVER_NAME="0.0.0.0"
49
  EXPOSE 7860
 
 
50
  CMD ["python", "app.py"]