swactor/tests/docker/Dockerfile.datastream

38 lines
1.9 KiB
Text
Raw Normal View History

2026-06-05 07:25:43 +00:00
# Datastream demo image (multi-stage, self-contained).
#
# The production image (../../Dockerfile) is `FROM scratch` over a static musl
# binary. This demo image instead compiles the binaries *inside* Docker and
# runs them on a slim glibc base. Building in the same Debian release as the
# runtime keeps glibc versions matched, so the image is portable regardless of
# the host's glibc — and you don't need a Rust toolchain on the host at all.
#
# Build context is the repo root (see docker-compose.datastream.yml). A
# sibling Dockerfile.datastream.dockerignore keeps the build context to the
# source tree (excludes target/, .git/).
FROM rust:1-bookworm AS builder
WORKDIR /src
COPY . .
RUN cargo build --release -p node -p distribution \
--bin swactor --bin swactor-datastream-collector --bin swactor-iroh-relay \
&& cargo build --release -p dashboard --features datastream \
--bin swactor-datastream-dashboard
FROM debian:bookworm-slim
# ca-certificates is handy for iroh's default relays; harmless otherwise.
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/target/release/swactor /usr/local/bin/swactor
COPY --from=builder /src/target/release/swactor-datastream-collector /usr/local/bin/swactor-datastream-collector
COPY --from=builder /src/target/release/swactor-iroh-relay /usr/local/bin/swactor-iroh-relay
COPY --from=builder /src/target/release/swactor-datastream-dashboard /usr/local/bin/swactor-datastream-dashboard
# Bake the demo config and the fixed seed identity into the image so the
# cluster is fully self-contained — no bind mounts (which are fragile across
# daemon configurations). The seed identity is a throwaway demo key.
COPY tests/docker/datastream-node.toml /etc/swactor/node.toml
COPY tests/docker/identities/seed /seed-identity
ENTRYPOINT ["swactor"]