viskav commited on
Commit
9efa685
·
verified ·
1 Parent(s): 9675430

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a slim Python image for a smaller container size
2
+ FROM python:3.11-slim
3
+
4
+ # Install system dependencies needed for llama-cpp-python to build
5
+ # This includes gcc, g++, and cmake
6
+ USER root
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ gcc \
9
+ g++ \
10
+ cmake \
11
+ && apt-get clean \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Set the working directory
15
+ WORKDIR /app
16
+
17
+ # Copy and install Python dependencies
18
+ COPY requirements.txt .
19
+ # Install llama-cpp-python, which builds llama.cpp from source
20
+ # --no-cache-dir helps keep the image size down
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Copy the application code
24
+ COPY app.py .
25
+
26
+ # Hugging Face Spaces Docker SDK default port
27
+ EXPOSE 7860
28
+
29
+ # Define the command to run the FastAPI application
30
+ # app:app refers to the 'app' FastAPI object in 'app.py'
31
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]