ProfessorCEO commited on
Commit
40bf46c
·
verified ·
1 Parent(s): af26621

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -0
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Setup a non-root user to prevent permission crashes on Hugging Face
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV HOME=/home/user \
7
+ PATH=/home/user/.local/bin:$PATH
8
+ WORKDIR $HOME/app
9
+
10
+ # Install Python dependencies
11
+ COPY --chown=user requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
+
14
+ # Download wget, pull the Phi-3 quantized model, and clean up to save storage
15
+ RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
16
+ RUN wget https://huggingface.co/bartowski/Phi-3-mini-4k-instruct-GGUF/resolve/main/Phi-3-mini-4k-instruct-Q4_K_M.gguf -O model.gguf
17
+
18
+ # Copy your backend API logic
19
+ COPY --chown=user app.py .
20
+
21
+ # Expose the default port Hugging Face looks for
22
+ EXPOSE 7860
23
+
24
+ # Start the FastAPI server
25
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]