Ahmad140 commited on
Commit
0b16f9a
·
verified ·
1 Parent(s): 9f927fd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -0
Dockerfile CHANGED
@@ -1,7 +1,37 @@
 
1
  FROM python:3.10-slim
 
 
2
  WORKDIR /app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  COPY requirements.txt .
4
  RUN pip install --no-cache-dir -r requirements.txt
 
 
5
  COPY . .
 
 
 
 
 
 
 
6
  EXPOSE 7860
 
 
7
  CMD ["python", "app.py"]
 
1
+ # Use Python 3.10 (required for prebuilt llama-cpp-python wheels)
2
  FROM python:3.10-slim
3
+
4
+ # Set working directory
5
  WORKDIR /app
6
+
7
+ # Install system dependencies (required for building C++ extensions and OpenBLAS)
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ cmake \
11
+ gcc \
12
+ g++ \
13
+ git \
14
+ libopenblas-dev \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Install llama-cpp-python from prebuilt wheel (fast, no compilation timeout)
18
+ RUN pip install --no-cache-dir \
19
+ https://huggingface.co/Luigi/llama-cpp-python-wheels-hf-spaces-free-cpu/resolve/main/llama_cpp_python-0.3.22-cp310-cp310-linux_x86_64.whl
20
+
21
+ # Copy requirements and install Python dependencies
22
  COPY requirements.txt .
23
  RUN pip install --no-cache-dir -r requirements.txt
24
+
25
+ # Copy application code
26
  COPY . .
27
+
28
+ # Environment variables for Flask/Gradio
29
+ ENV PYTHONUNBUFFERED=1
30
+ ENV GRADIO_SERVER_NAME=0.0.0.0
31
+ ENV FLASK_APP=app.py
32
+
33
+ # Expose the port Hugging Face expects
34
  EXPOSE 7860
35
+
36
+ # Run the Flask app
37
  CMD ["python", "app.py"]