Files
ssw-mpc/examples/12_k8s_two_party/Dockerfile
T
admin 49b421c23a feat(examples): 新增 mpc-examples,12 个场景对齐 nax/examples
- 新 workspace 成员 examples/(crate mpc-examples,publish = false):一场景一 bin,
  跑法 cargo run -p mpc-examples --bin 03_vertical_lr;src/lib.rs 只提供参与方启动、
  定点编解码、输出与断言,算法全在正文,调的是 mpc-* 真接口
- 12 个场景:01 密文四则/矩阵/sigmoid、02 PSI、03 纵向 LR、04 FedAvg、05 出域策略、
  06 DP-FedAvg、07 密文推理、08 PIR、09 SCQL、10 分箱 WOE/IV、11 试跑、12 两方部署
- 12 的部署物在 examples/12_k8s_two_party/:多阶段 Dockerfile + namespace /
  alice(Headless Service + Job,--listen)/ bob(Job,--connect)+ README;
  单二进制一条 TCP,不经 Ray,调度交给 k8s
- tools/ci.sh 加第 4 关「示例冒烟」,调新增的 tools/examples.sh:逐 bin 跑,
  判据为退出码 0 且输出无 [!!](check() 只打印不中断,只看退出码会漏断言)
- 正文记录三条实测契约:matmul_trunc 两入参都须是分片,否则结果翻倍;
  sigmoid_poly 只在 ±6 内有效,越界发散到 1e6;多项式输出须先 reveal 再解码
- 实测:07 密文与明文偏差 1.97e-5 且 AUC 一致;09 密态与明文逐组一致;
  11 同为 4 组 GROUP BY,逐组比较 156 轮 vs 整数码 23 轮
2026-11-05 20:55:07 +08:00

31 lines
982 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# mpc 演示镜像 —— 单二进制,无运行时依赖。
#
# 构建上下文必须是仓库根目录(要 COPY 整个 workspace):
# docker build -f examples/12_k8s_two_party/Dockerfile -t mpc:demo .
#
# MSRV 见根 Cargo.toml 的 rust-version。
FROM rust:1.85-slim AS build
WORKDIR /src
# 先只 COPY 清单,让依赖层能被缓存
COPY Cargo.toml Cargo.lock ./
COPY crates ./crates
COPY demo ./demo
COPY examples ./examples
RUN cargo build --release -p mpc-cli && strip target/release/mpc
FROM debian:bookworm-slim
# 只需要 glibc 与 ca-certificates;mpc 不发任何外部请求,证书是给将来留的。
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /src/target/release/mpc /usr/local/bin/mpc
# 非 root 跑:k8s 的 securityContext 也会再压一遍。
RUN useradd --system --uid 10001 --create-home mpc
USER 10001
ENTRYPOINT ["mpc"]
CMD ["version"]