# Lean image `lean.Dockerfile` builds the image the navier-stokes build check runs in. Tag: ``` shoal-ns-lean:f9e8bc5b ``` `scienceslack.json` refers to this exact name. ## Build On the machine whose runner will use it, from a checkout of the project's main (the context is that checkout: its tree goes into the image as the check's commits will be): ```bash sh docker/build.sh shoal-ns-lean:f9e8bc5b # on the Beijing host, on given cores: MIRRORS=cn CPUSET=32-63 sh docker/build.sh shoal-ns-lean:f9e8bc5b ``` `build.sh` does it in two steps, so that a failure late in the compile loses nothing. First `docker build` of `lean.Dockerfile` (tag `shoal-ns-lean:f9e8bc5b-base`): the tools, the toolchain, each package of `lake-manifest.json` fetched as the one commit it is pinned at, Mathlib's cache, and the tree. Then `lake build` in a container with no network; when it ends, `.lake/build` is given to `nobody` (the check builds a commit in place on top of it, `"in_place"` in `checks/build.json`) and the container is committed as `shoal-ns-lean:f9e8bc5b`. If either step stops, run the same command again: the layers already built are kept, and the container goes on from what Lake had compiled. The build needs the network (GitHub, the Lean release downloads, Go and Rust or their mirrors, the Mathlib cache). Nothing is published: the runner that runs the check must have the image locally. **Built on the production host, 12-02** (cores 32-63, `MIRRORS=cn`): `shoal-ns-lean:f9e8bc5b`, image id `656a504fbf49`, 23.5 GB (`-base` 15.3 GB). The long step compiled 11,411 jobs in 18.5 min; `.lake/build` is 6.9 GB, `nobody`'s. That image predates the line in `build.sh` that also builds every `lean_lib`; here the default targets are all three libraries, so nothing is missing. What a check costs on it: `checks/build.sbatch`'s comment. ## What is in it - `/opt/elan`: elan with the upstream's toolchain installed and set as the default, so `lake` works offline. - `/opt/proof`: the upstream at its pinned commit, with `.lake` fully built (dependencies, their oleans and the project's own). `PROOF_BASE=/opt/proof`. - On `PATH`: `lake`, `lean`, `comparator`, `lean4export`, `landrun`, `nanoda_bin`; also `python3`, `git`, `curl`, `zstd` and a C toolchain. ## How the check uses it `checks/build.py` (`scripts/lean-ci/README.md`) with `"in_place": true` and the standalone Comparator: the approved challenges are built and exported as root, the commit is built as `nobody` in the image's own `.lake/build` (Lake recompiles only what the commit changed), its two solution modules are exported, and `comparator` judges each pair of exports with nanoda and Lean's kernel, `landrun` replaced by a stand-in that serves the exports. ## Pins All pins are full commit hashes in `ARG`s at the top of `lean.Dockerfile`. After each clone the build checks `git rev-parse HEAD` against its pin and fails otherwise. | ARG | Value | Source | | --- | --- | --- | | `UPSTREAM_COMMIT` | `f9e8bc5b38b6e212696e8a30e3e91517af887bbd` | openai/NavierStokesAndEuler, `upstream.json` | | `TOOLCHAIN` | `leanprover/lean4:v4.34.0-rc2` | upstream `lean-toolchain` | | `MATHLIB_COMMIT` | `85e3a25e006c35636f0e53b0e9296caca2685bc0` | upstream `lake-manifest.json` (tag v4.34.0-rc2) | | `COMPARATOR_REV` | `19e111e2141cf333c7daff0f64c5f24acc91dd2e` | upstream `lake-manifest.json` (tag v4.34.0-rc2) | | `LEAN4EXPORT_REV` | `cacf989bd75f608700820f6afc595f32e7a99a4d` | upstream `lake-manifest.json` (tag v4.34.0-rc2) | | `LANDRUN_REV` | `811cfff51ceaf3d9843708aa6d22e9b84ccac8b4` (0.1.18) | PoincareConjecture `Comparator/README.md` | | `NANODA_REV` | `079049d584b2aed2b0172218164082f4fc6eede2` (0.4.18) | PoincareConjecture `Comparator/README.md` | | `GO_VERSION`, `GO_SHA256` | 1.24.13 | landrun's `go.mod` asks for Go 1.24; checksum from go.dev | | `RUST_VERSION` | 1.100.1 | Rust stable on 2026-12-01; nanoda builds with `cargo build --locked` | ## Rebuild when main moves The image is the build of one commit of main. Rebuild it, under a new tag, whenever main's `lean-toolchain` or `lake-manifest.json` changes (for example a new Lean release, or new Mathlib or Comparator pins): set `UPSTREAM_COMMIT` (and the other pins it moves) in `lean.Dockerfile`, build, give the tag the new commit's first eight hex digits, and change the tag in `scienceslack.json` in the same PR. The check refuses a commit whose `lean-toolchain` differs from the image's. Rebuilding after other changes to main is optional: it only makes the checks faster, since less has to be recompiled.