Skip to content

Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.

Rust
984 B
Raw Blame
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Keep RUST_VERSION in sync with rust-toolchain.toml.
ARG RUST_VERSION=1.96.1
FROM rust:${RUST_VERSION}-bookworm AS builder

WORKDIR /opt/switchyard
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
# .cargo/config.toml carries the workspace rustflags (target-cpu, force-frame-pointers).
COPY .cargo ./.cargo
COPY crates ./crates
COPY examples/dynamo-preproc ./examples/dynamo-preproc
COPY examples/claude ./examples/claude

RUN cargo build --locked --release -p switchyard-server

FROM debian:bookworm-slim

RUN apt-get update \
    && apt-get install --no-install-recommends -y ca-certificates \
    && rm -rf /var/lib/apt/lists/*

COPY --from=builder \
    /opt/switchyard/target/release/switchyard-server \
    /usr/local/bin/switchyard-server

ENV HOME=/tmp

USER 1000:1000
EXPOSE 4000

ENTRYPOINT ["switchyard-server", "--host", "0.0.0.0"]