# Use Python 3.11 like your local/Render setup FROM python:3.11-slim # System dependencies for numpy / pandas / sklearn / xgboost / shap, etc. RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ gcc \ g++ \ git \ libblas-dev \ liblapack-dev \ gfortran \ libgomp1 \ && rm -rf /var/lib/apt/lists/* # Workdir inside the container WORKDIR /app # Install Python packages COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the whole project COPY . . # HuggingFace exposes this port ENV PORT=7860 ENV PYTHONUNBUFFERED=1 ENV DJANGO_SETTINGS_MODULE=myproject.settings # Collect static files & run migrations RUN python manage.py collectstatic --noinput || true RUN python manage.py migrate --noinput || true # Start Django via Gunicorn, listening on $PORT CMD gunicorn myproject.wsgi:application --bind 0.0.0.0:${PORT} --workers 2