# Base image with CUDA 12.8, cuDNN 9, PyTorch 2.7.0 FROM pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime # Set working directory WORKDIR /usr/src/app # Install system dependencies, then clean up RUN apt-get update && \ apt-get install -y --no-install-recommends git wget && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Copy application files COPY . . # Install Python dependencies RUN pip install --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Make script executable and move it to PATH RUN install -m 755 sft.py /usr/local/bin/sft # Create a non-root user RUN useradd --create-home appuser RUN chown -R appuser:appuser /usr/src/app # Set environment variables ENV XDG_CACHE_HOME=/usr/src/app/cache # Use non-root user USER appuser RUN useradd -u 1000 trluser USER trluser # Expose the Gradio port EXPOSE 7860 ENV GRADIO_SERVER_NAME="0.0.0.0" # Start the application CMD ["python", "app.py"]