# PV-bench environment image: Coq 8.20.1 + Lean 4.25.2 + QCP backend (Rocq and Lean libs prebuilt, # Mathlib from the olean cache, symexec) + pinned agent CLIs. # Build context = a clean export of backend/ from a with-backend commit (`t3 image build`, pvbench_common.image) # plus docker/agents and docker/lean. # amd64 only for now: the QCP Linux symexec and the coqorg base image are x86-64; Apple Silicon runs it under Rosetta. # Base pinned by digest (the 8.20.1 tag as of 2026-11-05), so a rebuild starts from the same layers. FROM --platform=linux/amd64 coqorg/coq:8.20.1@sha256:18ebf3da56e60e3ddfd7d4e51f4c53d10241a129f34e93dacbc71562dd43c57a USER root RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl git ripgrep xz-utils zstd \ && rm -rf /var/lib/apt/lists/* # Node runtime for the agent CLIs, checked against the published sha256 ARG NODE_VERSION=22.12.0 ARG NODE_SHA256=22982235e1b71fa8850f82edd09cdae7e3f32df1764a9ec298c72d25ef2c164f RUN curl -fsSL -o /tmp/node.tar.xz "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \ && echo "${NODE_SHA256} /tmp/node.tar.xz" | sha256sum -c - \ && tar -xJ -C /usr/local --strip-components=1 -f /tmp/node.tar.xz && rm /tmp/node.tar.xz # Agent CLIs, pinned (one script per agent, Harbor style) COPY agents/ /opt/agents/ ARG CODEX_VERSION=0.162.1 ARG CLAUDE_VERSION=2.1.316 RUN /opt/agents/codex.sh "${CODEX_VERSION}" && /opt/agents/claude.sh "${CLAUDE_VERSION}" # Lean toolchain, checked against the published release tarball's sha256 (no elan: the # version is fixed, and nothing in a run may update it) ARG LEAN_VERSION=4.25.2 ARG LEAN_SHA256=41d5f900daa5167c08bd6185e6d69af83943ed3583a2dec44f2bfe7441b56cdb RUN curl -fsSL --http1.1 --retry 5 --retry-all-errors -o /tmp/lean.tar.zst "https://github.com/leanprover/lean4/releases/download/v${LEAN_VERSION}/lean-${LEAN_VERSION}-linux.tar.zst" \ && echo "${LEAN_SHA256} /tmp/lean.tar.zst" | sha256sum -c - \ && mkdir -p /opt/lean && tar --zstd -xf /tmp/lean.tar.zst -C /opt/lean --strip-components=1 && rm /tmp/lean.tar.zst # QCP backend: sources, strategies/headers, symexec. No .c demos, no gold (with-backend >= 65b624779). COPY --chown=coq:coq backend/Rocq /opt/qcp/Rocq COPY --chown=coq:coq backend/Lean /opt/qcp/Lean COPY --chown=coq:coq backend/QCP_examples /opt/qcp/QCP_examples COPY backend/binary/linux-binary/ /opt/qcp/bin/ RUN chmod 0755 /opt/qcp/bin/* # QCP's Lean examples ship complete proofs of benchmark cases (the LLM_bench tree); they # are not part of the backend libraries and must not be readable from a run. RUN rm -rf /opt/qcp/Lean/examples/SimpleC/EE/LLM_bench /opt/qcp/Lean/examples/SimpleC/EE/LLM_bench.lean USER coq ENV PATH=/home/coq/.opam/4.13.1+flambda/bin:/opt/lean/bin:/opt/qcp/bin:/usr/local/bin:/usr/bin:/bin RUN cd /opt/qcp/Rocq && make depend && make -j4 && find . -name '*.v' -newer Makefile -print -quit # Lean workspace: resolve the QCP Lean packages and Mathlib (olean cache, no source build), # then build every library module the corpus imports; case builds link this package tree. COPY --chown=coq:coq lean/lakefile.lean lean/PVBenchDeps.lean /opt/qcp/lean-ws/ COPY --chown=coq:coq lean/case-lakefile.lean /opt/qcp/lean-ws/case/lakefile.lean # (the base image's login shell resets PATH from opam's profile, hence the export) # (retries: the clones and the cache download are large transfers through whatever proxy the # build was given; `lake update` resumes with the packages already cloned) RUN export PATH=/opt/lean/bin:$PATH && cd /opt/qcp/lean-ws && cp /opt/qcp/Lean/examples/lean-toolchain . \ && git config --global http.version HTTP/1.1 && git config --global http.postBuffer 524288000 \ && retry() { for attempt in 1 2 3 4 5; do "$@" && return 0; echo "retry $attempt: $*" >&2; sleep 15; done; return 1; } \ && retry lake update \ && MATHLIB_CACHE_DIR=/tmp/mathlib-cache retry lake exe cache get && rm -rf /tmp/mathlib-cache \ && lake build \ && rm -rf /home/coq/.cache/mathlib # The packages' .git directories stay: Lake re-verifies each dependency's remote and revision # on every build and re-clones (which a read-only case build cannot) when they are missing. # Containers run as the operator's uid, not as coq, so git must accept repositories owned by # another user, or Lake reads the refusal as a changed URL and re-clones. USER root RUN git config --system safe.directory '*' USER coq WORKDIR /work