# ── Base image ───────────────────────────────────────────────────────────────── # Plain CUDA runtime — torch installed explicitly so its version is # guaranteed to align with bitsandbytes (avoids the conda torch mismatch). FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 # ── System deps ──────────────────────────────────────────────────────────────── ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ python3.10 \ python3.10-dev \ python3-pip \ git \ curl \ && ln -sf python3.10 /usr/bin/python \ && ln -sf python3.10 /usr/bin/python3 \ && rm -rf /var/lib/apt/lists/* # ── Install remaining Python deps ────────────────────────────────────────────── COPY requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt # ── App code ─────────────────────────────────────────────────────────────────── WORKDIR /app COPY app.py /app/app.py # ── LoRA adapter weights ─────────────────────────────────────────────────────── # Mount your saved adapter at /app/adapter at runtime: # docker run --gpus all -v /local/path/gemma-math-weakness:/app/adapter ... # Or COPY them in at build time (larger image): # COPY gemma-math-weakness/ /app/adapter/ # ── Environment variables ────────────────────────────────────────────────────── ENV HF_TOKEN="" ENV MODEL_NAME="google/gemma-4-E2B-it" ENV HF_HOME="/app/.cache/huggingface" ENV TOKENIZERS_PARALLELISM=false # ── Expose API port ──────────────────────────────────────────────────────────── EXPOSE 7860 # ── Run ──────────────────────────────────────────────────────────────────────── CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]