File size: 720 Bytes
f241609
4cea933
 
 
 
 
 
 
 
 
 
 
 
76eab21
 
4cea933
604d53b
4cea933
604d53b
4cea933
 
 
 
604d53b
 
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
FROM python:3.12-slim

WORKDIR /app

# Install system dependencies if required by any ML libraries
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Install python dependencies from the backend
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy all necessary files and directories
COPY . .

# Hugging Face Spaces mandates port 7860; can be overridden via PORT env var
EXPOSE 7860
EXPOSE 8000

# Ensure Python knows where to find the backend module
ENV PYTHONPATH=/app

# Start the FastAPI server with dynamic port support
CMD ["sh", "-c", "uvicorn backend.main:app --host 0.0.0.0 --port ${PORT:-7860}"]