git-git
SUCCESS
2m 33s
History Source
SummaryIterations1Transcript3Dockerfile
01Iteration 1
WRITEWriteFile· step #1
1s
Dockerfile1199 bytes written
text36 lines · 1199 chars
# Multi-stage build for the gitcore Rust crate (staticlib)

# Stage 1: Build the project from source using a Rust toolchain compatible with Cargo.toml
FROM rust:1.49.0-slim AS builder
WORKDIR /gitcore

# Copy manifest first to leverage build cache for dependencies (even though there are no dependencies)
COPY Cargo.toml Cargo.lock ./

# If there are no Cargo.lock in the repo, the above will copy an empty file which is fine.
# Fetch dependencies (if any) to warm up the cargo registry cache
RUN --mount=type=tmpfs,target=/cargo-cache,RUNFROM=1 true

# Copy the rest of the source code
COPY . ./

# Build the static library from source
RUN cargo build --release

# Stage 2: Runtime image
FROM debian:bullseye-slim AS runtime

# Install minimal runtime dependencies
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Copy the built static library from the builder stage
COPY --from=builder /gitcore/target/release/libgitcore.a /usr/local/lib/libgitcore.a

# Ensure library cache path is known
ENV LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"

# Provide a shell for inspection and a stable entrypoint
CMD ["/bin/sh"]
WRITEWriteFile· step #2
0s
Dockerfile827 bytes written
text29 lines · 827 chars
# Multi-stage build for the gitcore Rust crate (staticlib)

# Stage 1: Build the project from source using a Rust toolchain
FROM rust:1.49.0-slim AS builder
WORKDIR /gitcore

# Copy the entire source tree and build
COPY . ./

# Build the static library from source
RUN cargo build --release

# Stage 2: Runtime image
FROM debian:bullseye-slim AS runtime

# Install minimal runtime dependencies
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Copy the built static library from the builder stage
COPY --from=builder /gitcore/target/release/libgitcore.a /usr/local/lib/libgitcore.a

# Ensure library cache path is known
ENV LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"

# Provide a shell for inspection and a stable entrypoint
CMD ["/bin/sh"]
VERIFYVerifyBuild· step #3
1m 08s
VerifyBuildaccepted
Concerns: The build step assumes the Rust crate is configured to emit a static library named libgitcore.a; if crate-type or crate name differ, the COPY path may fail (libgitcore.a might not exist)., No build-dependency tooling is installed in the builder (e.g., pkg-config, libssl-dev) so crates requiring C libraries (openssl, zlib, etc.) could fail to compile., Runtime image is extremely minimal and only exposes a shell by default; there is no executable to exercise the library at runtime. This is fine for inspection, but consider adding a small test utility or adjusting CMD for actual usage.
Smoke [PASS]: test -f /usr/local/lib/libgitcore.a