Spaces:
Sleeping
Sleeping
File size: 819 Bytes
b3f9b1a cc1279f b3f9b1a cc1279f b3f9b1a cc1279f b3f9b1a | 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 | # 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"] |