From 75197b337813127ff125f7eed920310f10989e88 Mon Sep 17 00:00:00 2001 From: Peter Pan Date: Fri, 14 Aug 2026 15:39:38 +0800 Subject: [PATCH 1/2] feat(server): add Dockerfile for switchyard-server container image Signed-off-by: Peter Pan --- .dockerignore | 1 + Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore index 0941d4626..21ce6789e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,7 @@ .pytest_cache .ruff_cache .venv +target .worktrees benchmark/datasets benchmark/tb_runs diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..98f3a6d47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Build the standalone switchyard-server binary against the workspace lockfile. +FROM rust:1.96-bookworm AS builder +WORKDIR /app +COPY Cargo.toml Cargo.lock rust-toolchain.toml ./ +COPY crates/ crates/ +RUN cargo build --release --locked --package switchyard-server + +# Runtime image: binary only, runs unprivileged. Mount a TOML deployment at +# /etc/switchyard/config.toml and pass provider API keys as env vars. +FROM debian:bookworm-slim +RUN apt-get update \ + && apt-get install --yes --no-install-recommends ca-certificates \ + && rm -rf /var/lib/apt/lists/* \ + && useradd --system --uid 10001 switchyard +COPY --from=builder /app/target/release/switchyard-server /usr/local/bin/switchyard-server +USER switchyard +EXPOSE 4000 +ENTRYPOINT ["switchyard-server"] +CMD ["--config", "/etc/switchyard/config.toml"] From fd3b7c1f6911a84bf18781f8e12263deb31d5a3e Mon Sep 17 00:00:00 2001 From: Peter Pan Date: Fri, 14 Aug 2026 15:54:03 +0800 Subject: [PATCH 2/2] fix(server): apply workspace cargo rustflags and pin builder tag in Dockerfile Signed-off-by: Peter Pan --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 98f3a6d47..9523c3a9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,10 @@ # SPDX-License-Identifier: Apache-2.0 # Build the standalone switchyard-server binary against the workspace lockfile. -FROM rust:1.96-bookworm AS builder +FROM rust:1.96.1-bookworm AS builder WORKDIR /app COPY Cargo.toml Cargo.lock rust-toolchain.toml ./ +COPY .cargo/ .cargo/ COPY crates/ crates/ RUN cargo build --release --locked --package switchyard-server