# Use Python 3.11 FROM python:3.11-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV PORT 7860 # Set work directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ libpq-dev \ gcc \ && rm -rf /var/lib/apt/lists/* # Install dependencies COPY requirements.txt /app/ RUN pip install --no-cache-dir -r requirements.txt # Copy project COPY . /app/ # Expose the port Hugging Face expects EXPOSE 7860 # Start gunicorn on port 7860 CMD python manage.py migrate && gunicorn config.wsgi:application --bind 0.0.0.0:7860