Skip to content

Bake the p2p discovery sidecar into the image at build time - #37

Open
IrosTheBeggar wants to merge 1 commit into
linuxserver:masterfrom
IrosTheBeggar:bake-p2p-sidecar
Open

Bake the p2p discovery sidecar into the image at build time#37
IrosTheBeggar wants to merge 1 commit into
linuxserver:masterfrom
IrosTheBeggar:bake-p2p-sidecar

Conversation

@IrosTheBeggar

Copy link
Copy Markdown
Contributor

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

mStream 6.21+ ships a p2p discovery feature whose helper binary (the p2p-sidecar) is fetched on first use — sha256-verified against a manifest committed in the app tree. This PR runs the app's own pre-fetch script (scripts/fetch-p2p-sidecar.mjs, provided upstream for exactly this image-bake case) during the image build, right after npm install, so the binary ships inside the image. Applied identically to Dockerfile and Dockerfile.aarch64 (each arch fetches its own musl build at build time), plus a changelog line in readme-vars.yml.

Benefits of this PR and context:

  • Discovery works in containers without runtime egress to github.com — outbound-restricted setups currently can't use the feature at all.
  • No first-enable download latency; the container is self-sufficient the way it already is for ffmpeg/onnxruntime (installed via apk).
  • Supply chain unchanged: the build-time fetch verifies the same committed sha256 pins the runtime fetch uses, and a failed or tampered download fails the image build loudly (the script exits non-zero). Image size cost: ~8.6 MB.
  • Fully backward-compatible: without the baked binary, mStream's runtime fetch into /config continues to work as today.

I'm the mStream maintainer's agent-assisted contribution; the distribution model is documented at docs/p2p-sidecar-distribution.md and bin/p2p-sidecar/README.md.

How Has This Been Tested?

Built the x86_64 image from this branch (pulls the current mStream release, v6.21.2). Then in a --network none container:

  • /app/mstream/bin/p2p-sidecar/p2p-sidecar-linux-x64-musl is present, owned by abc, executable (8.6 MB);
  • running it as abc with --print-id returns a valid node id — the discovery helper works with zero network access.

Source / References:

mStream 6.21+ fetches its p2p discovery sidecar binary on first use,
sha256-verified against a manifest committed in the app tree. Baking it
at image build (the app ships a script for exactly this) means discovery
works in containers with no runtime egress to github.com and with no
first-enable download; the fetch is pinned+verified either way, and
images inherit new pins on their normal rebuilds. Runtime fetch remains
as the fallback for anything else, so nothing breaks for older images.

Verified: built the x86_64 image, then in a --network none container the
baked binary executes (--print-id returns a valid node id) as user abc.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@IrosTheBeggar
IrosTheBeggar marked this pull request as ready for review August 20, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants