viskav commited on
Commit
a3ec65b
·
verified ·
1 Parent(s): ac65024

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +49 -18
Dockerfile CHANGED
@@ -1,32 +1,63 @@
 
 
 
1
  FROM python:3.10-slim
2
 
3
- WORKDIR /code
4
-
5
- # Install build dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
- gcc \
9
- g++ \
10
  cmake \
11
  git \
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Copy requirements first
15
- COPY requirements.txt .
16
-
17
- # Install Python packages
18
- RUN pip install --upgrade pip && \
19
- pip install --no-cache-dir -r requirements.txt
20
-
21
- # Copy app
22
- COPY app.py .
23
-
24
- # Environment variables for optimization
25
  ENV PYTHONUNBUFFERED=1
 
 
26
  ENV N_THREADS=8
27
- ENV N_CTX=512
28
  ENV N_BATCH=256
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  EXPOSE 7860
31
 
32
- CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
1
+ # ================================
2
+ # Base image (HF Spaces compatible)
3
+ # ================================
4
  FROM python:3.10-slim
5
 
6
+ # ================================
7
+ # System dependencies
8
+ # ================================
9
  RUN apt-get update && apt-get install -y \
10
  build-essential \
 
 
11
  cmake \
12
  git \
13
+ curl \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # ================================
17
+ # Environment variables
18
+ # ================================
19
+ ENV PYTHONDONTWRITEBYTECODE=1
 
 
 
 
 
 
 
20
  ENV PYTHONUNBUFFERED=1
21
+
22
+ # Thread & context tuning (CPU)
23
  ENV N_THREADS=8
24
+ ENV N_CTX=2048
25
  ENV N_BATCH=256
26
 
27
+ # ================================
28
+ # Working directory
29
+ # ================================
30
+ WORKDIR /code
31
+
32
+ # ================================
33
+ # Copy requirements first (cache)
34
+ # ================================
35
+ COPY requirements.txt /code/requirements.txt
36
+
37
+ # ================================
38
+ # Install Python dependencies
39
+ # ================================
40
+ RUN pip install --no-cache-dir --upgrade pip \
41
+ && pip install --no-cache-dir -r requirements.txt
42
+
43
+ # ================================
44
+ # Copy application code
45
+ # ================================
46
+ COPY app.py /code/app.py
47
+
48
+ # ================================
49
+ # Copy model file
50
+ # IMPORTANT:
51
+ # The GGUF file MUST exist in repo
52
+ # ================================
53
+ COPY Phi-3.1-mini-4k-instruct-IQ2_M.gguf /code/
54
+
55
+ # ================================
56
+ # Expose FastAPI port
57
+ # ================================
58
  EXPOSE 7860
59
 
60
+ # ================================
61
+ # Start FastAPI app
62
+ # ================================
63
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]