dpv007 commited on
Commit
bcce341
·
verified ·
1 Parent(s): af19818

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -0
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python 3.10 base image
2
+ FROM python:3.10-slim
3
+
4
+ # 1. Install system dependencies required to compile llama.cpp
5
+ RUN apt-get update && apt-get install -y \
6
+ build-essential \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ # 2. Hugging Face strictly requires running as a non-root user (UID 1000)
10
+ RUN useradd -m -u 1000 user
11
+ USER user
12
+
13
+ # Set up environment variables for the user
14
+ ENV HOME=/home/user \
15
+ PATH=/home/user/.local/bin:$PATH
16
+
17
+ # 3. Set the working directory
18
+ WORKDIR $HOME/app
19
+
20
+ # 4. Copy requirements and install them
21
+ # We do this before copying the rest of the code to leverage Docker layer caching
22
+ COPY --chown=user requirements.txt $HOME/app/
23
+ RUN pip install --no-cache-dir --upgrade pip && \
24
+ pip install --no-cache-dir -r requirements.txt
25
+
26
+ # 5. Copy the main application code
27
+ COPY --chown=user app.py $HOME/app/
28
+
29
+ # 6. Expose port 7860 (The standard port for HF Spaces)
30
+ EXPOSE 7860
31
+
32
+ # 7. Start the Uvicorn server