File size: 753 Bytes
a48f347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Small, stable Python base image
FROM python:3.11-slim

# Prevent Python from writing .pyc files and ensure stdout is unbuffered
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

# All subsequent paths relative to /app
WORKDIR /app

# Use the latest pip (often faster/more compatible)
RUN pip install --no-cache-dir --upgrade pip

# Install Python deps first (better Docker layer caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the project (app.py, model, README, etc.)
COPY . .

# Hugging Face Spaces exposes port 7860 for Docker apps by convention.
# Uvicorn will bind to 0.0.0.0 so the container is reachable externally.
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]