FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive # Install base dependencies RUN apt-get update && \ apt-get install -y software-properties-common && \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y \ python3.10 \ python3.10-venv \ python3.10-distutils \ python3-pip \ wget \ git \ libgl1 \ fontconfig \ libglib2.0-0 \ libxrender1 \ libsm6 \ libxext6 \ poppler-utils && \ rm -rf /var/lib/apt/lists/* RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 # Create app directory WORKDIR /app # Copy requirements first COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt && \ pip install --no-cache-dir torch==2.0.1+cu118 torchvision==0.15.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 # Create output directories RUN mkdir -p /app/output/images && \ chmod -R 777 /app/output # Copy application code COPY app/ /app/app/ COPY pdf_converter/ /app/pdf_converter/ COPY app.py . # Set environment variables for GPU ENV NVIDIA_VISIBLE_DEVICES=all ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility # Expose port 7860 for Hugging Face Spaces EXPOSE 7860 # Command to run the application on port 7860 CMD ["python3", "app.py"]