Adi362 commited on
Commit
04e5519
·
verified ·
1 Parent(s): 7ef84f5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -2
Dockerfile CHANGED
@@ -1,7 +1,31 @@
 
1
  FROM python:3.11-slim
 
 
2
  WORKDIR /app
 
 
 
 
 
 
 
 
3
  COPY requirements.txt .
 
 
4
  RUN pip install --no-cache-dir -r requirements.txt
 
 
5
  COPY . .
6
- EXPOSE 8000
7
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official lightweight Python image
2
  FROM python:3.11-slim
3
+
4
+ # Set the working directory in the container
5
  WORKDIR /app
6
+
7
+ # Install build tools needed for llama-cpp-python
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ cmake \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy the requirements file into the container
14
  COPY requirements.txt .
15
+
16
+ # Install the Python dependencies
17
  RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the application code into the container
20
  COPY . .
21
+
22
+ # Hugging Face Spaces run as user 1000.
23
+ # We need to make sure the app directory is writable so the
24
+ # huggingface_hub can download and cache the GGUF model in ./models
25
+ RUN mkdir -p /app/models && chmod -R 777 /app
26
+
27
+ # Expose the correct port for Hugging Face Spaces
28
+ EXPOSE 7860
29
+
30
+ # Command to start the FastAPI application
31
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]