Files
mathew/lean/entrypoint.sh
Aran Roig e2c2c66d7f
Some checks failed
Build and Deploy Lean / build (push) Failing after 16m44s
Build and Deploy Nuxt / build (push) Failing after 48s
Vibecoded CI/CD
2026-10-06 00:23:17 +02:00

28 lines
1.1 KiB
Bash

#!/bin/sh
# Mathew — lean server entrypoint.
#
# In the usual image this does nothing: the built Mathlib already sits under
# the project and the server starts straight away.
#
# With the image built as `--build-arg BAKE_MATHLIB=false` (see README's
# "Keeping Mathlib out of the image"), the project's .lake is meant to be a
# volume: a fresh one gets filled once, at first start, so Mathlib's ~7GB of
# compiled cache never travels through the registry.
set -eu
PROJECT=/opt/lean4web/Projects/MathlibDemo
if [ ! -f "$PROJECT/.lake/build/lib/lean/MathlibDemo.olean" ]; then
echo "[mathew-lean] $PROJECT/.lake holds no built Mathlib — fetching it once (expect ~10 minutes)"
cd "$PROJECT"
# lake update pulls the sources pinned in lake-manifest.json, and Mathlib's
# post-update hook fetches the matching precompiled cache; lake build then
# only writes the project's own module. The image's pinned toolchain
# (elan) stays as it is — no lean-toolchain re-curl, no surprise downloads.
lake update -R
lake build
echo "[mathew-lean] Mathlib ready"
fi
exec "$@"