feat(examples): docker-cross-all — one linux image cross-builds all 8 targets#924
Open
zackees wants to merge 8 commits into
Open
feat(examples): docker-cross-all — one linux image cross-builds all 8 targets#924zackees wants to merge 8 commits into
zackees wants to merge 8 commits into
Conversation
… targets
Replaces the per-OS GH Actions matrix with a single local-docker step.
The image bakes:
1. soldr (PyPI wheel)
2. rustup + 1.94.1 channel (`soldr bootstrap` + `soldr toolchain
install`)
3. `soldr prepare --target all` — zig, LLVM, Apple SDK, xwin MSVC
CRT cache, every `rustup target add` for the 8 triples declared
in `[workspace.metadata.soldr].targets`.
`build.sh` loops the targets through `soldr cargo build --release
--target <triple>`, copies each artifact back to `out/<triple>/`, and
prints per-target wall-clock plus `du -sh` of `target/<triple>/` and
its `incremental/` subdir. The final report dumps the cargo per-
platform layout so the cache shape is auditable at a glance.
Iteration 1 of the loop: ships the skeleton; cache save/load wiring,
optimization passes, and end-to-end docker build validation are
follow-ups tracked outside this PR.
Refs #914.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The seed/Cargo.toml workaround existed only so `soldr prepare --target all` had a `[workspace.metadata.soldr].targets` table to read from at image-build time. Switching to the explicit comma-separated form (soldr PR #925) lets the bake step pass the 8 triples directly and removes the seed manifest entirely. Now requires a soldr release containing #925. Bump SOLDR_VERSION when that lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the `pipx install soldr==<ver>` step with a two-stage build:
Stage 1 — debian + rust 1.94.1 + git clone soldr at `SOLDR_GIT_REF`
(default main) + `cargo build --release`
Stage 2 — runtime image with the built binary copied in + the
existing soldr bootstrap / toolchain install / prepare
sequence
Avoids the PyPI release cadence — the example always builds against
latest main (which now includes #925's comma-separated --target
form). Override with `--build-arg SOLDR_GIT_REF=<sha|branch>` to
pin a specific revision.
Image grows by the rust-toolchain layer in stage 1 but stage 2
remains lean; the final image carries only the soldr binary.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…orks soldr prepare calls bare `rustup target add` via PATH (root-caused in issue #927). When soldr-managed rustup lives at `/root/.soldr/bin` (not on PATH by default), every target's rustup-target-add silently fails — the image looks prepared but only the host triple is actually installed. Workaround: prepend /root/.soldr/bin to PATH in stage 2 before `soldr bootstrap` runs. This makes the rustup discovery succeed and all 8 targets get added. Also drop the misleading CARGO_HOME/RUSTUP_HOME env settings — soldr manages those internally and the env-var override wasn't actually honored (the cargo proxy at /opt/cargo/bin/ remained empty). Drop this workaround once #927 lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
build.sh now dispatches by target family:
*-pc-windows-msvc → soldr cargo xwin build
*-apple-darwin → soldr cargo zigbuild
*-unknown-linux-{gnu,musl} → soldr cargo zigbuild
Without the dispatch, plain `soldr cargo build` for windows-msvc dies
with "linker `link.exe` not found"; for darwin, the system linker
can't produce Mach-O. cargo-xwin and cargo-zigbuild auto-fetch on
first use (soldr's cargo front door), so no extra prepare step is
needed — the underlying assets (xwin CRT cache, zig, Apple SDK,
LLVM) were already baked into the image.
Also adds `MSYS_NO_PATHCONV=1` so the docker run survives Git-for-
Windows shell path translation, matching what `examples/docker-cross-
win/build.sh` already does.
Verified end-to-end on linux/amd64 docker: all 8 targets in
[workspace.metadata.soldr].targets build green. Per-target binary
sizes 128KB-432KB; aggregate target/ tree 4.6MB partitioned cleanly
by triple.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Iteration 1 of
/loop— replaces the per-OS GH Actions matrix with a single local-docker recipe that bakessoldr prepare --target <comma-list>into the image so a freshdocker rundoes zero network fetches before going intocargo build.Blocked on #925 — uses the comma-separated
--targetform that ships in that PR.What's in the image
pip install soldr==<version>)soldr bootstrap+soldr toolchain install)soldr prepare --target <comma-list>— zig, LLVM, Apple SDK, xwin MSVC CRT cache,rustup target addfor all 8 triples). The explicit comma-separated list is used because at image-build time no source volume is mounted, so--target allcan't read[workspace.metadata.soldr].targets.What
build.shdoessoldr cargo build --release --target <triple>.out/<triple>/.file(1)type, anddu -shoftarget/<triple>/andtarget/<triple>/release/incremental/.target/partition report so the cargo per-platform layout is visible — input to the cache-design iteration that follows.Draft because
End-to-end
docker build+docker runvalidation is iteration 2 of this loop. It also needs #925 to land in a PyPI release first.Follow-ups tracked by the loop
soldr prepare --target <list>along the way.soldr save <stable-path>/soldr load <same-path>for one cache artifact per repo at a stable name (no per-target fan-out).Depends on #925.
Refs #914.
🤖 Generated with Claude Code