File size: 924 Bytes
d064478
 
22f7966
 
 
 
d064478
 
22f7966
 
 
 
 
 
 
 
d064478
22f7966
d064478
 
 
22f7966
 
d064478
22f7966
d064478
0461d65
22f7966
 
 
 
0461d65
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
31
32
FROM python:3.11-slim

# Set environment variables to keep Python from buffering and writing .pyc
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /app

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

# Upgrade pip and install uvicorn/fastapi EXPLICITLY first
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir uvicorn fastapi

# Copy the rest of the requirements and install
COPY backend-ml/requirements-lite.txt /app/
RUN pip install --no-cache-dir -r requirements-lite.txt

# Copy the project files
COPY . /app/

# Ensure we are in the directory where main.py lives
WORKDIR /app/backend-ml

# Final check: port 7860 is required for Hugging Face
EXPOSE 7860

# Launch using the python -m method
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]