Skip to content

feat(image): bake a sha256-pinned prebuilt DuckDB shared library into the Rust sandbox variant - #233

Closed
debuggingfuture wants to merge 2 commits into
mainfrom
feat/duckdb-prebuilt-image
Closed

debuggingfuture wants to merge 2 commits into
mainfrom
feat/duckdb-prebuilt-image

Conversation

@debuggingfuture

@debuggingfuture debuggingfuture commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

The WITH_RUST variant of infra/Dockerfile.sandbox-demo (RunSandbox) ships DuckDB's prebuilt libduckdb.so and headers under /opt/duckdb, so a consumer that links DuckDB skips the C++ compile that dominates a cold cargo test.

  • One ARG DUCKDB_VERSION=v1.5.5 pins the release; the libduckdb-linux-amd64.zip asset is verified with sha256sum -c (digest matches the one GitHub publishes for the asset). Other architectures fail the build.
  • DUCKDB_LIB_DIR / DUCKDB_INCLUDE_DIR are exported, and an /etc/ld.so.conf.d/duckdb.conf entry puts the library on the loader path for every exec user, so a linked build both links and runs. The build asserts ldconfig -p resolves libduckdb.so.
  • libduckdb-sys 1.10505.x reads both variables only in build_linked, compiled under #[cfg(not(feature = "bundled"))]; a bundled build ignores them. Its linked path emits rustc-link-search and dylib=duckdb but nothing for runtime loading, which the ldconfig entry covers.
  • The release's static archive is left out: the layer serves dynamic linking, and the archive would double the layer.
  • The consumer opt-in (build duckdb without bundled in CI, assert the loaded library version at startup, move the crate pin with DUCKDB_VERSION) is documented on the layer and in the RunSandbox comment in wrangler.jsonc.
  • In a linked Linux build DUCKDB_LIB_DIR takes precedence over DUCKDB_DOWNLOAD_LIB=1; a consumer whose crate pin differs from DUCKDB_VERSION unsets it in its run command.

Spec: specs/adr/0007-cost-efficient-execution.md, "Prebuilt heavy native dependencies in the image" (#232). The ADR names the lean sandbox image; the layer ships in the WITH_RUST variant of infra/Dockerfile.sandbox-demo instead, because RunSandbox is the only class with a Rust toolchain to build a linked consumer, and infra/Dockerfile.sandbox sets WITH_RUST for no class.

Testing: pnpm install --frozen-lockfile, pnpm lint, pnpm typecheck, pnpm test (205 files, 2814 passed, 1 skipped) pass. The asset digest matches the one GitHub publishes for libduckdb-linux-amd64.zip v1.5.5, and the libduckdb-sys 1.10505.0 build.rs behavior above is read from the published crate. Not yet run: an image build of the layer and a linked cargo build against it; no PR CI builds images, so the first build is the deploy on main unless one runs before merge.

@flaredispatch-fractalboxdev flaredispatch-fractalboxdev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI code review — ✅ Approve

Risk tier: full · 0 critical · 0 warnings · 0 suggestions

Reviewers: security 0 · performance ⚠️ · code-quality ⚠️ · documentation ⚠️ · release-management 0 · compliance ⚠️ · agents-md 0

No findings.

📋 View full logs & reviewed diff ↗

@debuggingfuture

Copy link
Copy Markdown
Member Author

Folded into #235, which now carries ADR-0007 in full.

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