FROM rust:1.86-bookworm AS build

WORKDIR /app

COPY Cargo.toml Cargo.lock ./
COPY src ./src
COPY engines ./engines

RUN cargo build --locked --release -p uforia-ms-app

FROM debian:bookworm-slim

WORKDIR /app

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

COPY --from=build /app/target/release/uforia-ms-app /usr/local/bin/uforia-ms-app
COPY engines/microstructure/config ./engines/microstructure/config

ENV RUST_LOG=info

ENTRYPOINT ["uforia-ms-app"]
