Spaces:
Sleeping
Sleeping
| # Dockerfile for Hugging Face Spaces deployment | |
| # Optimized for ML inference with scikit-learn | |
| FROM python:3.10-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/* \ | |
| && apt-get clean | |
| # Copy requirements first for caching | |
| COPY requirements-api.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements-api.txt | |
| # Copy application code | |
| COPY src/ ./src/ | |
| COPY params.yaml ./ | |
| COPY metrics.json ./ | |
| # Copy model files (downloaded by workflow) | |
| COPY models/ ./models/ | |
| # Set environment variables | |
| ENV PYTHONPATH=/app | |
| ENV PYTHONUNBUFFERED=1 | |
| # Memory optimization | |
| ENV OMP_NUM_THREADS=1 | |
| ENV MKL_NUM_THREADS=1 | |
| ENV OPENBLAS_NUM_THREADS=1 | |
| # Hugging Face Spaces uses port 7860 | |
| EXPOSE 7860 | |
| # Run the API | |
| CMD ["python", "-m", "uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "7860"] | |
| # Build trigger: 20260117v4 | |