# Image for the 0.4.x line. The only binary this line ships is the admin CLI (`auth-framework`,
# behind the `admin-binary` feature); there is no server binary and no `auth-framework-cli`.
FROM rust:1.94-slim AS builder
ENV CARGO_TERM_COLOR=never \
CARGO_NET_RETRY=10 \
CARGO_HTTP_TIMEOUT=600
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libpq-dev \
libssl-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
RUN cargo build --release --locked --features admin-binary --bin auth-framework && \
strip target/release/auth-framework
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libpq5 \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -r -g 1000 authfw && \
useradd -r -g authfw -u 1000 -m -d /app authfw
WORKDIR /app
COPY --from=builder /app/target/release/auth-framework /usr/local/bin/auth-framework
COPY --chown=authfw:authfw config/ ./config/
USER authfw
CMD ["auth-framework", "--help"]
FROM builder AS testing
RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql-client \
redis-tools \
&& rm -rf /var/lib/apt/lists/*
CMD ["cargo", "test", "--all-features", "--release"]