# Auto-generated Dockerfile to build the static Rust library for gitcore
# Build stage: compile the static library libgitcore.a using a Rust toolchain
FROM rust:1.94.0-slim-trixie AS builder
WORKDIR /workspace
# Install required system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy source and build
COPY . .
RUN cargo build --release
# Final stage: provide a minimal runtime environment that exposes the built library
FROM debian:bookworm-slim
# Copy the static library from the builder stage
COPY --from=builder /workspace/target/release/libgitcore.a /usr/local/lib/libgitcore.a
# Ensure the library location exists and is readable
RUN mkdir -p /usr/local/lib \
&& chmod 644 /usr/local/lib/libgitcore.a
# Keep the container alive and provide a small status message on startup
CMD ["sh", "-lc", "echo 'libgitcore.a available at /usr/local/lib/libgitcore.a'; tail -f /dev/null"]
# Ignore git metadata and IDE/editor files .git .gitignore node_modules target .idea .vscode *.rs.bk .DS_Store Cargo.lock
Concerns: The build expects a static library libgitcore.a to be produced. If the Cargo.toml crate-type is not configured to produce a staticlib (crate-type = ["staticlib"]), the file /workspace/target/release/libgitcore.a may not exist, causing a build failure., COPYing to /usr/local/lib/libgitcore.a assumes /usr/local/lib exists in the final Debian image. While typically present, some minimal images may not have this directory unless created first. Smoke [FAIL]: test -f /usr/local/lib/libgitcore.a && echo 'libgitcore.a present' || echo 'missing libgitcore.a Output: sh: 1: Syntax error: Unterminated quoted string Smoke [PASS]: ls -l /usr/local/lib/libgitcore.a Smoke [PASS]: stat -c '%n %s bytes' /usr/local/lib/libgitcore.a
# Auto-generated Dockerfile to build the static Rust library for gitcore
# Build stage: compile the static library libgitcore.a using a Rust toolchain
FROM rust:1.94.0-slim-trixie AS builder
WORKDIR /workspace
# Install required system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy source and build
COPY . .
RUN cargo build --release
# Final stage: provide a minimal runtime environment that exposes the built library
FROM debian:bookworm-slim
# Copy the static library from the builder stage
COPY --from=builder /workspace/target/release/libgitcore.a /usr/local/lib/libgitcore.a
# Ensure the library location exists and is readable
RUN mkdir -p /usr/local/lib \
&& chmod 644 /usr/local/lib/libgitcore.a
# Keep the container alive but do nothing
CMD ["/bin/true"]
Concerns: Build may fail if the Rust crate is not configured to emit a static library named libgitcore.a (i.e., crate-type must include 'staticlib'); cargo build --release will only produce libgitcore.a if the Cargo.toml crate-type includes a static library., The final image uses /bin/true as CMD, which means the container does nothing at runtime. This is intentional for a library-packaging image but may be surprising if a runnable process is expected. Smoke [PASS]: test -f /usr/local/lib/libgitcore.a Smoke [PASS]: test -s /usr/local/lib/libgitcore.a Smoke [PASS]: ls -l /usr/local/lib/libgitcore.a