Skip to content

Build a new image out of an image and a user's state - #22

Merged
daniel-rossier merged 1 commit into
mainfrom
build-from-state
Nov 19, 2026
Merged

daniel-rossier merged 1 commit into
mainfrom
build-from-state

Conversation

@daniel-rossier

Copy link
Copy Markdown
Contributor

spear-run.sh --build TAG makes a new image from the current one plus the user's state directory:

  • the corpora registered in the container go into the image's registry, their path made relative to the home and their collection named;
  • their collections are copied into the image's index, vectors included;
  • the accepted knowledge of named workspaces goes into the image's common store.

The source trees are not copied. It runs spear-bake-state, a tool of the image, as root in a container with the state mounted read-only, then commits it.

Also fixes --tree NAME, which only worked for the last corpus of an image: the lookup loop's exit status ended the script under set -e.

Checked end to end on a test image: a tree registered and indexed in a container, the image built, then run from another home with an empty state and its own checkout: the corpus opens with its 3 chunks, and a shipped corpus still answers (4260 chunks). Unit tests for the three merges; the suite passes (4511 tests).

Someone who registered trees, indexed them and recorded knowledge in a
container could not hand that on: it lived in their state directory only.

The launcher's new build option runs a tool of the image as root, with the
state mounted read-only, then commits the container under the given tag.
The tool adds the user's corpora to the image's registry, copies their
collections into its index, vectors included, and adds the accepted
knowledge to its common store. A corpus path under the user's home becomes
relative to it, with its collection named, so the index follows a checkout
at the same place under another home. The source trees are not copied.

Naming a corpus on the launcher's command line only worked for the last
one of the image: the lookup's exit status ended the script. It is fixed
and the test now has two corpora.
@daniel-rossier
daniel-rossier merged commit 772a1d3 into main Nov 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant