FROM rust:1.61.0-slim as builder
COPY ./template ./template
COPY ./src ./src
COPY ./Cargo.toml ./Cargo.toml
RUN cargo build --release
# find the excecutable
RUN mkdir ./output
RUN mv $(find ./target/release -maxdepth 1 -executable -type f) ./output/exec

FROM debian:bullseye-slim
COPY --from=builder ./output .
CMD ["/exec"]
