# PixelLock — GPU Space. # A fine-tuned *text* LLM (Gemma-4-12B) rewrites a sprite as a PALETTE/GRID text # wire under a per-sprite GBNF grammar (llama.cpp) that locks the silhouette by # construction. We base on the OFFICIAL prebuilt llama.cpp CUDA server image so # there is NO source compile (compiling the CUDA kernels OOM-kills the free HF # builder) — this ships the exact `llama-server` we validated, plus a Gradio UI. FROM ghcr.io/ggml-org/llama.cpp:server-cuda # --- add Python + our deps on top of the llama.cpp CUDA runtime -------------- USER root ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip curl ca-certificates \ && rm -rf /var/lib/apt/lists/* # Make the server binary reachable as `llama-server` regardless of its path in # the base image (it ships at /app/llama-server). RUN ln -sf "$(command -v llama-server || echo /app/llama-server)" /usr/local/bin/llama-server || true COPY requirements.txt /tmp/requirements.txt # Ubuntu 24.04 base → PEP 668 blocks system pip installs; --break-system-packages # is the intended escape hatch inside a container. RUN pip3 install --no-cache-dir --break-system-packages -r /tmp/requirements.txt # --- non-root user (HF Spaces requirement) ---------------------------------- # The base image already has a uid-1000 user; -o allows reusing the UID under a # new name so `USER user` / `--chown=user` resolve cleanly. RUN useradd -m -u 1000 -o user USER user ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH WORKDIR /home/user/app # --- bake the fine-tuned GGUF into the image (fast, token-free cold starts) --- ENV MODEL_REPO=solarkyle/pixellock-gemma-12b-pixelart-gguf \ MODEL_FILE=pixellock-gemma-12b-q4_k_m.gguf \ MODEL_PATH=/home/user/app/model.gguf RUN python3 -c "import os, shutil; from huggingface_hub import hf_hub_download; \ shutil.copy(hf_hub_download(os.environ['MODEL_REPO'], os.environ['MODEL_FILE']), os.environ['MODEL_PATH'])" # --- app code (Gradio UI + engine modules) ---------------------------------- COPY --chown=user . /home/user/app ENV PYTHONUNBUFFERED=1 \ PIXELLOCK_ENDPOINT=http://127.0.0.1:8080/v1/chat/completions \ PIXELLOCK_MODEL=pixellock \ PIXELLOCK_MAX_DIM=64 \ PORT=7860 EXPOSE 7860 # Reset the base image's entrypoint (it launches llama-server directly) so our # startup script runs both llama-server (background) and the Gradio UI. ENTRYPOINT [] CMD ["bash", "start.sh"]