FROM python:3.10-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Copy requirements first COPY requirements.txt . # Install Python packages (use pre-built wheels) RUN pip install --no-cache-dir --only-binary :all: \ fastapi==0.104.1 \ uvicorn==0.24.0 \ numpy==1.24.3 \ scikit-learn==1.3.0 \ torch==2.0.1 \ --index-url https://download.pytorch.org/whl/cpu # Copy application COPY app.py . EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]