FROM rust:1.95 AS builder
WORKDIR /git
# Copy manifest to leverage Docker layer caching when dependencies exist
COPY Cargo.toml .
# Copy the rest of the source code
COPY . .
# Build the static library from source
RUN cargo build --release
FROM debian:stable-slim AS runtime
# Install minimal runtime dependencies (staticlib does not require runtime, but include tools for inspection)
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates binutils \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /git
# Copy the static library from the builder stage
COPY --from=builder /git/target/release/libgitcore.a /usr/local/lib/libgitcore.a
# Default to an interactive shell so the container can be used as a library package
CMD ["/bin/bash"]