Files
wehub-resource-sync 9f97f3abbe
CI - Python Bindings / sdist (push) Failing after 1s
CI - Python Bindings / Build x86_64-unknown-linux-musl (push) Failing after 1s
CI / fmt (push) Failing after 1s
E2E Output Validation / compare-outputs (push) Failing after 1s
Sync Docs to Developer Hub / sync-docs (push) Failing after 1s
CI - Python Bindings / Build x86_64-unknown-linux-gnu (push) Failing after 1s
CI - WASM Bindings / Build WASM (push) Failing after 0s
CI / clippy (push) Failing after 1s
CI / build-and-test (ubuntu-latest) (push) Failing after 0s
CI - WASM Bindings / Edge runtime PDF parse test (push) Has been skipped
CI - WASM Bindings / Browser PDF parse test (push) Has been skipped
Deploy Demo to GitHub Pages / deploy (push) Failing after 1s
CI / build-docker-image (push) Failing after 3s
CI - Node Bindings / Build darwin-x64 (push) Has been cancelled
CI - Node Bindings / Test win32-x64-msvc (push) Has been cancelled
CI - Node Bindings / Build linux-arm64-gnu (push) Has been cancelled
CI - Node Bindings / Build linux-x64-gnu (push) Has been cancelled
CI - Node Bindings / Build linux-x64-musl (push) Has been cancelled
CI - Node Bindings / Build win32-arm64-msvc (push) Has been cancelled
CI - Node Bindings / Build win32-x64-msvc (push) Has been cancelled
CI - Node Bindings / Test darwin-arm64 (push) Has been cancelled
CI - Node Bindings / Test darwin-x64 (push) Has been cancelled
CI - Node Bindings / Test linux-x64-gnu (push) Has been cancelled
CI - Node Bindings / Test linux-x64-musl (push) Has been cancelled
CI - Node Bindings / Test win32-arm64-msvc (push) Has been cancelled
CI - Python Bindings / Build aarch64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Build x86_64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Build x86_64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Build aarch64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Build aarch64-unknown-linux-gnu (push) Has been cancelled
CI - Node Bindings / Build darwin-arm64 (push) Has been cancelled
CI - Python Bindings / Test x86_64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Test aarch64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Test x86_64-unknown-linux-gnu (push) Has been cancelled
CI - Python Bindings / Test x86_64-unknown-linux-musl (push) Has been cancelled
CI - Python Bindings / Test aarch64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Test x86_64-pc-windows-msvc (push) Has been cancelled
CI / build-and-test (macos-26-intel) (push) Has been cancelled
CI / build-and-test (macos-latest) (push) Has been cancelled
CI / build-and-test (windows-11-arm) (push) Has been cancelled
CI / build-and-test (windows-latest) (push) Has been cancelled
E2E Output Validation / upload-dataset (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:23:44 +08:00

52 lines
1.9 KiB
Docker

# Single image: GPU-enabled llama.cpp `llama-server` + the Surya OCR API.
#
# Based on the official CUDA llama.cpp server image, which already provides a
# `qwen35`-capable `llama-server` (with libggml-cuda), the CUDA runtime, and
# Python 3.12. Surya's llamacpp backend finds `llama-server` on PATH and spawns
# it INSIDE this same container, so one image runs both the API and the model
# server. Run with `--gpus all`.
#
# (Stock Ollama's bundled llama.cpp cannot load Surya 2's custom qwen35 GGUF;
# this upstream build can.)
FROM ghcr.io/ggml-org/llama.cpp:server-cuda
# Bring uv in from its official image (no external install script needed).
COPY --from=ghcr.io/astral-sh/uv:0.11.21 /uv /usr/local/bin/uv
# Python/runtime libs for Surya, torch, and Pillow.
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-venv \
libgl1 \
libglib2.0-0 \
libgomp1 \
libcurl4 \
&& rm -rf /var/lib/apt/lists/*
# llama-server and its shared libraries live in /app.
ENV PATH="/app:${PATH}"
ENV LD_LIBRARY_PATH="/app:${LD_LIBRARY_PATH}"
# Surya: llama.cpp backend, all layers on GPU. Surya spawns llama-server and
# downloads the GGUF weights from Hugging Face on the first OCR request.
ENV SURYA_INFERENCE_BACKEND=llamacpp
ENV LLAMA_CPP_NGL=99
# Surya's layout step is the only request that sends a grammar; its regex
# `pattern` breaks the upstream llama.cpp grammar parser. Run layout
# unconstrained so the OCR pipeline returns results on this build.
ENV SURYA_GUIDED_LAYOUT=false
# Cache model weights (Surya torch models + the GGUF) under /models.
ENV HF_HOME=/models
WORKDIR /opt/app
# Copy project metadata, lockfile, and server code
COPY pyproject.toml uv.lock README.md server.py test_server.py ./
# Install dependencies (uses the committed lockfile)
RUN uv sync --frozen
# The base image's entrypoint is llama-server; clear it and run the API.
ENTRYPOINT []
EXPOSE 8830
CMD ["uv", "run", "python3", "server.py"]