FROM node:latest AS front
WORKDIR /app
COPY front .
RUN npm i && npm run build

FROM rust:latest AS back
WORKDIR /app
COPY back .
RUN cargo build --release

FROM debian:bookworm-slim
WORKDIR /app
RUN apt update && apt install -y libsqlite3-0
COPY --from=front /app/dist /app/public
COPY --from=back /app/target/release/back /app/back
EXPOSE 2486
CMD ["/app/back"]

