File size: 802 Bytes
99012f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Use a small Python image
FROM python:3.10-slim

# Prevents Python from writing .pyc files and buffers logs (better for containers)
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Create app directory
WORKDIR /home/user/app

# System deps (optional: add build tools if you need them)
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
 && rm -rf /var/lib/apt/lists/*

# Copy and install Python deps
COPY requirements.txt /home/user/app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy your app code
COPY . /home/user/app

# Expose the port Hugging Face expects
EXPOSE 7860
ENV PORT=7860

# Run the FastAPI app
# NOTE: app:app -> <module>:<FastAPI instance name>
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]