Spaces:
Sleeping
Sleeping
| # Use an official Python runtime | |
| FROM python:3.11-slim | |
| # Force Python to print logs immediately | |
| ENV PYTHONUNBUFFERED=1 | |
| # 1. FIX MATPLOTLIB WARNING: Give it a writable temp folder | |
| ENV MPLCONFIGDIR=/tmp/matplotlib | |
| # 2. FIX LIGHTGBM ERROR: Install the missing Linux C++ library | |
| RUN apt-get update && apt-get install -y libgomp1 && rm -rf /var/lib/apt/lists/* | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy requirements and install them | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all your backend files into the container | |
| COPY . . | |
| # Grant file permissions to Hugging Face user | |
| RUN chown -R 1000:1000 /app | |
| USER 1000 | |
| # Hugging Face Spaces MUST expose port 7860 | |
| EXPOSE 7860 | |
| # Command to run your FastAPI server | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |