File size: 961 Bytes
e50f22e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
# 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