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

fix(container): make server image non-root compatible (#128)

Bhuvan Agrawal3bd5fa678190
diff --git a/benchmark/switchyard-server.Dockerfile b/benchmark/switchyard-server.Dockerfile
index efb11bd38..18185ba21 100644
--- a/benchmark/switchyard-server.Dockerfile
+++ b/benchmark/switchyard-server.Dockerfile
@@ -7,16 +7,19 @@ FROM rust:${RUST_VERSION}-bookworm
COPY --from=ghcr.io/astral-sh/uv:0.9.17 /uv /uvx /usr/local/bin/
WORKDIR /opt/switchyard
+# Hosted runtimes can override the container UID, so keep Python and package imports
+# independent of root's home and the copied source tree.
ENV PATH="/opt/switchyard/.venv/bin:${PATH}" \
PYTHONUNBUFFERED=1 \
UV_LINK_MODE=copy \
- UV_PROJECT_ENVIRONMENT=/opt/switchyard/.venv
+ UV_PROJECT_ENVIRONMENT=/opt/switchyard/.venv \
+ UV_PYTHON_INSTALL_DIR=/opt/uv-python
COPY pyproject.toml uv.lock README.md Cargo.toml Cargo.lock ./
COPY crates ./crates
COPY switchyard ./switchyard
COPY switchyard_rust ./switchyard_rust
-RUN uv sync --frozen --no-dev --extra server --extra cli
+RUN uv sync --frozen --no-dev --extra server --extra cli --no-editable
ENTRYPOINT ["switchyard"]