# Multi-stage build for fraiseql-wire
# Supports: linux/amd64, linux/arm64
# Stage 1: Builder
FROM rust:latest as builder
WORKDIR /app
# Copy manifests
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src ./src
# Build the library (not a binary, so we just compile)
RUN cargo build --release --lib
# Stage 2: Runtime (stripped down)
FROM debian:bookworm-slim
# Install minimal runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create non-root user
RUN groupadd -r app && useradd -r -g app app
# Copy built artifacts from builder
COPY --from=builder /app/target/release/*.rlib /app/target/release/
# This is a library crate, not a binary
# Users would include fraiseql-wire as a dependency in their projects
LABEL maintainer="fraiseql-wire <dev@fraiseql.example.com>"
LABEL version="0.1.0"
LABEL description="Minimal async Postgres JSON streaming query engine - library only"
# Copy source for reference/documentation
COPY . /app/src/
# Switch to non-root user
USER app
CMD ["/bin/sh", "-c", "echo 'fraiseql-wire is a library, not a standalone application. See https://github.com/fraiseql/fraiseql-wire for usage.'"]