# Base image with CUDA 12.8, cuDNN 9, PyTorch 2.7.0 | |
FROM pytorch/pytorch:2.7.0-cuda12.8-cudnn9-devel | |
# 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 | |
# Set environment variable for Hugging Face cache | |
ENV HF_HOME=/usr/src/app/.cache/huggingface | |
# Make /usr/src/app/ a writable directory | |
RUN chmod -R 777 /usr/src/app | |
# Expose the Gradio port | |
EXPOSE 7860 | |
ENV GRADIO_SERVER_NAME="0.0.0.0" | |
# Start the application | |
CMD ["python", "app.py"] | |