45 lines
1.6 KiB
Docker
45 lines
1.6 KiB
Docker
# Build stage
|
|
FROM rust:1-bookworm as builder
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
clang cmake pkg-config libssl-dev git ca-certificates curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# sccache optional in release, but still useful for CI
|
|
RUN cargo install sccache
|
|
ENV RUSTC_WRAPPER=/usr/local/cargo/bin/sccache
|
|
|
|
WORKDIR /work
|
|
# Copy manifests first to leverage Docker layer caching
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY crates/mabelabrs-core/Cargo.toml crates/mabelabrs-core/Cargo.toml
|
|
COPY crates/mabelabrs-world/Cargo.toml crates/mabelabrs-world/Cargo.toml
|
|
COPY crates/mabelabrs-eval/Cargo.toml crates/mabelabrs-eval/Cargo.toml
|
|
COPY crates/mabelabrs-io/Cargo.toml crates/mabelabrs-io/Cargo.toml
|
|
COPY crates/mabelabrs-utils/Cargo.toml crates/mabelabrs-utils/Cargo.toml
|
|
COPY crates/mabelabrs-ffi/Cargo.toml crates/mabelabrs-ffi/Cargo.toml
|
|
|
|
# Create empty src to allow dependency build caching
|
|
RUN mkdir -p crates/mabelabrs-utils/src && echo "fn main(){}" > crates/mabelabrs-utils/src/main.rs
|
|
|
|
# Build deps
|
|
RUN cargo build -p mabelabrs-utils --release || true
|
|
|
|
# Now copy the whole source and do the real build
|
|
COPY . .
|
|
RUN cargo build -p mabelabrs-utils --release
|
|
|
|
# Runtime stage (distroless-ish; use slim for better debugability)
|
|
FROM debian:bookworm-slim
|
|
|
|
# If your CLI needs SSL/DNS, keep these minimal libs
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates libssl3 && rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
COPY --from=builder /work/target/release/mabelabrs-utils /usr/local/bin/mabelabrs-utils
|
|
|
|
ENTRYPOINT ["/usr/local/bin/mabelabrs-utils"]
|
|
CMD ["--help"]
|
|
|