FROM python:3.9-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies RUN pip install --no-cache-dir \ fastapi>=0.95.0 \ uvicorn>=0.21.0 \ pydantic>=1.10.7 \ onnxruntime>=1.14.0 \ sentence-transformers>=2.2.0 \ numpy>=1.20.0 \ pyyaml>=6.0 # Copy application code COPY app.py . COPY models/ models/ # Expose port EXPOSE 7860 # Set environment variables ENV PYTHONPATH=/app ENV MODELS_DIR=/app/models # Run the API server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]