A library for ATProtocol identities.
1# Multi-stage build for atproto-identity-rs workspace
2# Builds and installs all 13 binaries from the workspace
3
4# Build stage - use 1.89 to support resolver = "3" and edition = "2024"
5FROM rust:1.89-slim AS builder
6
7# Install system dependencies needed for building
8RUN apt-get update && apt-get install -y \
9 pkg-config \
10 libssl-dev \
11 && rm -rf /var/lib/apt/lists/*
12
13# Set working directory
14WORKDIR /usr/src/app
15
16# Copy the entire workspace
17COPY . .
18
19# Build all binaries in release mode
20# This will build all binaries defined in the workspace:
21# - atproto-identity: 4 binaries (resolve, key, sign, validate)
22# - atproto-record: 2 binaries (sign, verify)
23# - atproto-client: 3 binaries (auth, app-password, dpop)
24# - atproto-oauth: 1 binary (service-token)
25# - atproto-oauth-axum: 1 binary (oauth-tool)
26# - atproto-jetstream: 1 binary (jetstream-consumer)
27# - atproto-xrpcs-helloworld: 1 binary (xrpcs-helloworld)
28# - atproto-lexicon: 1 binary (lexicon-resolve)
29# Note: atproto-identity-resolve and atproto-lexicon-resolve require hickory-dns feature
30RUN cargo build --release --bins -F clap,hickory-dns,zeroize,tokio
31
32# Runtime stage - use distroless for minimal attack surface
33FROM gcr.io/distroless/cc-debian12
34
35# Create directory for binaries
36WORKDIR /usr/local/bin
37
38# Copy all built binaries from builder stage
39COPY --from=builder /usr/src/app/target/release/atproto-identity-resolve .
40COPY --from=builder /usr/src/app/target/release/atproto-identity-key .
41COPY --from=builder /usr/src/app/target/release/atproto-identity-sign .
42COPY --from=builder /usr/src/app/target/release/atproto-identity-validate .
43COPY --from=builder /usr/src/app/target/release/atproto-record-sign .
44COPY --from=builder /usr/src/app/target/release/atproto-record-verify .
45COPY --from=builder /usr/src/app/target/release/atproto-client-auth .
46COPY --from=builder /usr/src/app/target/release/atproto-client-app-password .
47COPY --from=builder /usr/src/app/target/release/atproto-client-dpop .
48COPY --from=builder /usr/src/app/target/release/atproto-oauth-service-token .
49COPY --from=builder /usr/src/app/target/release/atproto-oauth-tool .
50COPY --from=builder /usr/src/app/target/release/atproto-xrpcs-helloworld .
51COPY --from=builder /usr/src/app/target/release/atproto-jetstream-consumer .
52COPY --from=builder /usr/src/app/target/release/atproto-lexicon-resolve .
53
54# Default to the main resolution tool
55# Users can override with specific binary: docker run <image> atproto-identity-resolve --help
56# Or run other tools:
57# docker run <image> atproto-identity-key --help
58# docker run <image> atproto-record-sign --help
59# docker run <image> atproto-client-auth --help
60# docker run <image> atproto-oauth-service-token --help
61# docker run <image> atproto-oauth-tool --help
62# docker run <image> atproto-xrpcs-helloworld --help
63# docker run <image> atproto-jetstream-consumer --help
64# docker run <image> atproto-lexicon-resolve --help
65CMD ["atproto-identity-resolve", "--help"]
66
67# Add labels for documentation
68LABEL org.opencontainers.image.title="atproto-identity-rs"
69LABEL org.opencontainers.image.description="AT Protocol identity management tools"
70LABEL org.opencontainers.image.authors="Nick Gerakines <nick.gerakines@gmail.com>"
71LABEL org.opencontainers.image.source="https://tangled.sh/@smokesignal.events/atproto-identity-rs"
72LABEL org.opencontainers.image.version="0.12.0"
73LABEL org.opencontainers.image.licenses="MIT"
74
75# Document available binaries
76LABEL binaries="atproto-identity-resolve,atproto-identity-key,atproto-identity-sign,atproto-identity-validate,atproto-record-sign,atproto-record-verify,atproto-client-auth,atproto-client-app-password,atproto-client-dpop,atproto-oauth-service-token,atproto-oauth-tool,atproto-jetstream-consumer,atproto-xrpcs-helloworld,atproto-lexicon-resolve"