B2 Build the ALCHEMI image¶
Base: OCI image pinned by digest.
Copied into the SIF: two lock files and the ALCHEMI MD example.
Locks pin build and runtime packages with hashes; they ship with the repository, not generated in class.

alchemi-aarch64.def
1Bootstrap: docker
2From: docker.io/library/python@sha256:519591d6871b7bc437060736b9f7456b8731f1499a57e22e6c285135ae657bf7
3
4# Build from this directory on an aarch64 Apptainer builder.
5%files
6 locks/build-requirements.lock /opt/mlip/build-requirements.lock
7 locks/requirements.lock /opt/mlip/requirements.lock
8 examples/alchemi_si.py /opt/mlip/alchemi_si.py
9
10%environment
11 export PYTHONNOUSERSITE=1
alchemi-aarch64.def
14%post
15 set -eu
16 python -m pip install --no-cache-dir --no-deps --require-hashes \
17 -r /opt/mlip/build-requirements.lock
18 python -m pip install --no-cache-dir --no-deps --no-build-isolation \
19 --require-hashes -r /opt/mlip/requirements.lock
20
21%test
22 python -c 'import platform; assert platform.machine() == "aarch64"'
23 python -c 'import torch,nvalchemi,mace; assert torch.version.cuda == "12.6"'
24 python -m py_compile /opt/mlip/alchemi_si.py
Full Apptainer definition, build lock and runtime lock are in the checkout. The definition installs the locked packages; locks are not model weights.
Before the GPU exercises, on an aarch64 Apptainer builder (not a notebook cell), set a new output path outside Git and run:
export MLIP_SIF_OUTPUT=/path/outside/git/alchemi-aarch64.sif
bash scripts/build-alchemi-sif.sh
The script builds into a temporary .partial file (staged) and moves it
into place only after apptainer sif list succeeds, so no incomplete SIF
appears at the final path.
build-alchemi-sif.sh
13staged="$MLIP_SIF_OUTPUT.partial.$$.sif"
14test ! -e "$staged"
15trap 'echo "build left staging at: $staged" >&2' ERR
16cd "$here"
17apptainer build "$staged" alchemi-aarch64.def
18apptainer sif list "$staged" >/dev/null
19mv -n -- "$staged" "$MLIP_SIF_OUTPUT"
Highlighted: apptainer build. The excerpt omits preflight checks; run the
complete build script.
Note
The MACE checkpoint stays outside the image. scripts/run-alchemi.sh selects
it explicitly and mounts it read-only, so image and model stay independent and a new model needs no
rebuild.
Record base image digest, both locks and SIF identity.
%testonly checks imports; run a short GPU MD job in a real allocation before using a new image.