FROM ubuntu:24.04 # ── System dependencies ─────────────────────────────────────────────────────── ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ cmake \ curl \ wget \ ca-certificates \ python3 \ python3-pip \ python3-dev \ python3-venv \ git \ && rm -rf /var/lib/apt/lists/* # ── Python env ──────────────────────────────────────────────────────────────── RUN python3 -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" # PyTorch CPU (conversion only — no GPU needed) RUN pip install --upgrade pip && \ pip install --no-cache-dir \ torch==2.5.1+cpu \ --index-url https://download.pytorch.org/whl/cpu # HF ecosystem + conversion deps RUN pip install --no-cache-dir \ transformers \ huggingface_hub[cli] \ safetensors \ sentencepiece \ tiktoken \ gguf \ numpy \ tqdm # ── Clone llama.cpp (fast — no compile here, that happens at container start) ─ # We need the source for two things: # 1. convert_hf_to_gguf.py (Python, runs immediately) # 2. llama-quantize source (compiled at runtime to avoid build timeout) RUN git clone --depth 1 https://github.com/ggml-org/llama.cpp.git /opt/llama.cpp RUN pip install --no-cache-dir -r /opt/llama.cpp/requirements.txt || true # ── Runtime secrets ─────────────────────────────────────────────────────────── ENV HF_TOKEN="" ENV HF_DATASET_REPO="" ENV LLAMA_CPP_DIR="/opt/llama.cpp" # ── Working directories ─────────────────────────────────────────────────────── RUN mkdir -p /workspace/model-fp8 \ /workspace/model-bf16 \ /workspace/model-gguf \ /workspace/output WORKDIR /workspace COPY scripts/ /workspace/scripts/ RUN chmod +x /workspace/scripts/*.sh ENTRYPOINT ["/bin/bash", "/workspace/scripts/entrypoint.sh"]