viskav commited on
Commit
c5bc322
·
verified ·
1 Parent(s): 4acd6aa

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +3 -23
Dockerfile CHANGED
@@ -1,11 +1,5 @@
1
- # ---------------------------------------------------------
2
- # Dockerfile for HuggingFace Spaces (Custom Docker Runtime)
3
- # Runs FastAPI + llama-cpp-python + GGUF model
4
- # ---------------------------------------------------------
5
-
6
  FROM python:3.11-slim
7
 
8
- # Install system dependencies required by llama-cpp-python
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
  build-essential \
11
  cmake \
@@ -15,34 +9,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
15
  libopenblas-dev \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
- # Set the working directory
19
  WORKDIR /code
20
 
21
- # Copy requirements first (for better Docker cache)
22
  COPY requirements.txt /code/requirements.txt
23
-
24
- # Install Python dependencies
25
  RUN pip install --no-cache-dir --upgrade pip \
26
  && pip install --no-cache-dir -r /code/requirements.txt
27
 
28
- # Copy application file
29
  COPY app.py /code/app.py
30
 
31
- # Copy your model folder (GGUF file)
32
- COPY model /code/model
33
 
34
- # Environment variables for llama.cpp backend
35
- ENV MODEL_PATH=/code/model/Phi-3.1-mini-4k-instruct-IQ2_M.gguf
36
- ENV N_THREADS=4
37
- ENV N_CTX=4096
38
- ENV N_BATCH=512
39
- ENV N_GPU_LAYERS=0
40
- ENV MAX_CONCURRENT_REQUESTS=6
41
- ENV PYTHONUNBUFFERED=1
42
 
43
- # HuggingFace Spaces requires server to run on port 7860
44
  EXPOSE 7860
45
 
46
- # Start FastAPI with uvicorn
47
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
48
 
 
 
 
 
 
 
1
  FROM python:3.11-slim
2
 
 
3
  RUN apt-get update && apt-get install -y --no-install-recommends \
4
  build-essential \
5
  cmake \
 
9
  libopenblas-dev \
10
  && rm -rf /var/lib/apt/lists/*
11
 
 
12
  WORKDIR /code
13
 
 
14
  COPY requirements.txt /code/requirements.txt
 
 
15
  RUN pip install --no-cache-dir --upgrade pip \
16
  && pip install --no-cache-dir -r /code/requirements.txt
17
 
 
18
  COPY app.py /code/app.py
19
 
20
+ # Copy model (NO folder needed)
21
+ COPY Phi-3.1-mini-4k-instruct-IQ2_M.gguf /code/
22
 
23
+ ENV MODEL_PATH=/code/Phi-3.1-mini-4k-instruct-IQ2_M.gguf
 
 
 
 
 
 
 
24
 
 
25
  EXPOSE 7860
26
 
 
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
28