# teamclaw-server: static musl build into distroless. The same image serves # the air-gapped bundle and the cloud registry. FROM rust:1.96-slim AS builder ARG TARGETARCH RUN apt-get update \ && apt-get install -y --no-install-recommends musl-tools \ && rm -rf /var/lib/apt/lists/* RUN case "$TARGETARCH" in \ arm64) echo aarch64-unknown-linux-musl > /rust-target ;; \ *) echo x86_64-unknown-linux-musl > /rust-target ;; \ esac \ && rustup target add "$(cat /rust-target)" WORKDIR /src COPY Cargo.toml rust-toolchain.toml ./ COPY crates ./crates COPY migrations ./migrations COPY .sqlx ./.sqlx ENV SQLX_OFFLINE=true RUN cargo build --release --target "$(cat /rust-target)" -p teamclaw-server \ && cp "target/$(cat /rust-target)/release/teamclaw-server" /teamclaw-server FROM gcr.io/distroless/static-debian12:nonroot COPY --from=builder /teamclaw-server /usr/local/bin/teamclaw-server USER nonroot ENTRYPOINT ["/usr/local/bin/teamclaw-server"]