FROM rust:slim-buster as builder
RUN cargo new --bin rust-and-docker
WORKDIR ./rust-and-docker
COPY ./Cargo.toml ./Cargo.toml
COPY ./src ./src
RUN cargo build --release
// if you need sql or postgres
// RUN apt-get -y update &&
// apt-get -y upgrade &&
// apt -y install ca-certificate libssl-dev libpq-dev sqlit3
FROM debian:buster-slim
COPY --from=builder /rust-and-docker/target/release/rust-and-docker ./rust-and-docker
// use cargo.toml name instead rust-and-docker
CMD ["./rust-and-docker"]