FROM rust:1.89.0 AS builder

WORKDIR /usr/src/asklyphe/
COPY vorebot vorebot
COPY asklyphe-common asklyphe-common
COPY lyphedb lyphedb

RUN --mount=type=cache,target=$CARGO_HOME/registry,sharing=locked \
	--mount=type=cache,target=/usr/src/asklyphe/vorebot/target \
	--mount=type=cache,target=$CARGO_HOME/git/db,sharing=locked \
	cargo install --debug --path vorebot/

FROM debian:trixie-slim
RUN apt-get update && apt-get upgrade -y && apt-get install -y libssl3 && rm -rf /var/lib/apt-get/lists/*
COPY --from=builder /usr/local/cargo/bin/vorebot /usr/local/bin/

CMD ["vorebot"]
