# clawmates-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 tools ./tools COPY images/seccomp ./images/seccomp COPY migrations ./migrations COPY .sqlx ./.sqlx ENV SQLX_OFFLINE=true RUN cargo build --release --target "$(cat /rust-target)" -p clawmates-server \ && cp "target/$(cat /rust-target)/release/clawmates-server" /clawmates-server FROM gcr.io/distroless/static-debian12:nonroot COPY --from=builder /clawmates-server /usr/local/bin/clawmates-server USER nonroot ENTRYPOINT ["/usr/local/bin/clawmates-server"]