# Drafting QLoRA trainer. Built on GHA, pushed to public ghcr.
# RunPod pulls ghcr anonymously — never Docker Hub at pod-create (negotiated-x0l).
# Rebuild after entrypoint heartbeat, train.py, or the checkpoint-index fixture
# changes. --dry-run resolves target modules against __fixtures__/ (no GPU).
FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime

RUN pip install --no-cache-dir \
		'transformers>=4.51.0' \
		'peft>=0.14.0' \
		'trl>=0.15.0' \
		'bitsandbytes>=0.45.0' \
		'datasets>=3.0.0' \
		'accelerate>=1.2.0' \
		'huggingface_hub[hf_transfer]'

WORKDIR /app
COPY train.py entrypoint.sh /app/
COPY __fixtures__/ /app/__fixtures__/
RUN chmod +x /app/entrypoint.sh /app/train.py

ENV HF_HUB_ENABLE_HF_TRANSFER=1 \
	PYTHONUNBUFFERED=1

ENTRYPOINT ["/app/entrypoint.sh"]
