# Use a high-performance CUDA base image FROM nvidia/cuda:12.1.0-devel-ubuntu22.04 # Set environment variables for non-interactive installs ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 # Install Python and essential build tools RUN apt-get update && apt-get install -y \ python3-pip \ python3-dev \ git \ && rm -rf /var/lib/apt/lists/* # Upgrade pip and install wheel RUN pip3 install --no-cache-dir --upgrade pip wheel # Install Unsloth and its core dependencies # We use the specific install command recommended for CUDA 12.1 RUN pip3 install --no-cache-dir \ "unsloth[colab-new] @ git+https://github.com" \ --extra-index-url https://download.pytorch.org # Install TRL and Transformers for the Trainer subclassing RUN pip3 install --no-cache-dir trl transformers accelerate datasets # Set the working directory WORKDIR /app # Copy your custom logic into the container COPY . /app # The entrypoint to start training CMD ["python3", "train.py"]