26 lines
1.1 KiB
Docker
26 lines
1.1 KiB
Docker
FROM rust:1.99-bookworm AS build
|
|
|
|
ARG RUST_TARGET=x86_64-unknown-linux-musl
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends musl-tools cmake \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /src
|
|
ENV CARGO_TARGET_DIR=/src/control-plane/target
|
|
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
|
|
# After the toolchain file is in place: the floating rust:1.99 tag can carry a newer patch than the pinned 1.99.0, and the target must be
|
|
# installed for the toolchain rustup actually selects (adding it before made the build fail with "can't find crate for `core`").
|
|
RUN rustup target add "${RUST_TARGET}"
|
|
COPY crates/ ./crates/
|
|
COPY manifests/ ./manifests/
|
|
COPY desktop-core/ ./desktop-core/
|
|
COPY control-plane/ ./control-plane/
|
|
COPY engine/strata/LICENSE ./engine/strata/LICENSE
|
|
COPY engine/strata/serve/chat_template.jinja ./engine/strata/serve/chat_template.jinja
|
|
RUN cargo build --manifest-path control-plane/Cargo.toml --locked --release \
|
|
--target "${RUST_TARGET}" --bin leleka-api
|
|
|
|
FROM scratch
|
|
ARG RUST_TARGET=x86_64-unknown-linux-musl
|
|
COPY --from=build /src/control-plane/target/${RUST_TARGET}/release/leleka-api /leleka-api
|
|
ENTRYPOINT ["/leleka-api"]
|