Yousuf-Islam commited on
Commit
f40f69d
·
verified ·
1 Parent(s): 8b003a0

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -0
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python image
2
+ FROM python:3.10-slim
3
+
4
+ # Set work directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies (optional but useful)
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements first (to leverage Docker layer caching)
13
+ COPY requirements.txt .
14
+
15
+ # Install Python dependencies
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Copy the rest of the repo (including model files and main.py)
19
+ COPY . .
20
+
21
+ # Hugging Face Spaces expects the app on port 7860
22
+ ENV PORT=7860
23
+
24
+ # Expose port (not strictly required by HF, but good practice)
25
+ EXPOSE 7860
26
+
27
+ # Start FastAPI with uvicorn
28
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]