rahul7star commited on
Commit
876aa1a
·
verified ·
1 Parent(s): a9f1c6c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -82
Dockerfile CHANGED
@@ -1,99 +1,32 @@
1
  FROM python:3.10-slim
2
 
3
- # ============================================================
4
- # ENV
5
- # ============================================================
6
-
7
- ENV DEBIAN_FRONTEND=noninteractive
8
- ENV PYTHONUNBUFFERED=1
9
- ENV HF_HOME=/tmp/huggingface
10
- ENV PIP_NO_CACHE_DIR=1
11
- ENV HF_HUB_ENABLE_HF_TRANSFER=1
12
-
13
- # ============================================================
14
- # SYSTEM DEPS
15
- # ============================================================
16
-
17
  RUN apt-get update && apt-get install -y \
18
- git \
19
- git-lfs \
20
  build-essential \
21
  cmake \
22
- ninja-build \
23
- wget \
24
- curl \
25
- pkg-config \
26
- ccache \
27
- libopenblas-dev \
28
  && rm -rf /var/lib/apt/lists/*
29
 
30
- # ============================================================
31
- # PYTHON DEPS FIRST (CACHEABLE)
32
- # ============================================================
33
-
34
- WORKDIR /app
35
-
36
- COPY requirements.txt .
37
-
38
- RUN pip install --upgrade pip setuptools wheel
39
-
40
- RUN pip install --no-cache-dir -r requirements.txt
41
-
42
- # ============================================================
43
- # LLAMA.CPP
44
- # ============================================================
45
-
46
- WORKDIR /app
47
 
48
- # IMPORTANT:
49
- # Pin commit instead of git pull
50
- RUN git clone https://github.com/ggml-org/llama.cpp
51
 
 
52
  WORKDIR /app/llama.cpp
 
53
 
54
- # Pin stable commit for cache stability
55
- RUN git checkout b5093
56
-
57
- # ============================================================
58
- # BUILD
59
- # ============================================================
60
-
61
- RUN cmake -B build \
62
- -G Ninja \
63
- -DCMAKE_BUILD_TYPE=Release
64
-
65
- RUN cmake --build build -j$(nproc)
66
-
67
- # ============================================================
68
- # OPTIONAL CALIBRATION DATASET
69
- # ============================================================
70
-
71
  WORKDIR /app
 
 
72
 
73
- RUN wget -O wiki.train.raw \
74
- https://huggingface.co/datasets/ikawrakow/validation-datasets/resolve/main/wiki.train.raw
75
-
76
- # ============================================================
77
- # APP CODE LAST
78
- # ============================================================
79
-
80
  COPY . .
81
 
82
- # ============================================================
83
- # HF CACHE
84
- # ============================================================
85
-
86
- RUN mkdir -p /tmp/huggingface
87
- RUN chmod -R 777 /tmp/huggingface
88
-
89
- # ============================================================
90
- # PORT
91
- # ============================================================
92
-
93
- EXPOSE 7860
94
-
95
- # ============================================================
96
- # START
97
- # ============================================================
98
 
 
99
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Install system dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  RUN apt-get update && apt-get install -y \
 
 
5
  build-essential \
6
  cmake \
7
+ git \
 
 
 
 
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Set environment variable for HF cache
11
+ ENV HF_HOME=/tmp/huggingface_cache
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ # Clone llama.cpp
14
+ RUN git clone https://github.com/ggerganov/llama.cpp /app/llama.cpp
 
15
 
16
+ # Build llama.cpp
17
  WORKDIR /app/llama.cpp
18
+ RUN mkdir -p build && cd build && cmake .. && make
19
 
20
+ # Set up Python environment
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  WORKDIR /app
22
+ COPY requirements.txt .
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
 
25
+ # Copy your app code
 
 
 
 
 
 
26
  COPY . .
27
 
28
+ # Ensure the cache directory exists
29
+ RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
+ # Set the entrypoint
32
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]