FROM nvidia/cuda:12.1.0-base-ubuntu22.04 # Prevent interactive prompts during apt installs ENV DEBIAN_FRONTEND=noninteractive # Install Python 3.11, pip, and minimal build tools RUN apt-get update && \ apt-get install -y --no-install-recommends \ python3.11 \ python3.11-venv \ python3.11-dev \ python3-pip \ build-essential \ libevent-dev \ && python3.11 -m pip install --upgrade pip setuptools wheel \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy dependency list and install using Python 3.11 explicitly COPY requirements.txt . RUN python3.11 -m pip install --no-cache-dir -r requirements.txt \ && python3.11 -c "import eventlet; print('eventlet version:', eventlet.__version__)" \ && rm -rf ~/.cache/pip # Copy source code last (better layer caching) COPY . . # Expose the port expected by Hugging Face Spaces EXPOSE 7860 # Run the app explicitly with Python 3.11 to avoid system default mismatches CMD ["python3.11", "app.py"]