In the dockerfile, you'll need to copy the Cargo.toml before calling cargo install (or whatever the command for installing dependencies) but you'll want to do that before copying all the files. Something along the lines of this:
COPY ./Cargo.toml .
RUN cargo install
COPY ./ . # copy the rest
Notes:
cargo run my-script.rs
once you've donecargo init
In the dockerfile, you'll need to copy the Cargo.toml before calling
cargo install
(or whatever the command for installing dependencies) but you'll want to do that before copying all the files. Something along the lines of this: