To make sure you have smaller image, do this for the Rustup step:
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile minimal --target x86_64-unknown-linux-gnu -y
--profile minimal part is crucial and it shaved off ~500MB from our Docker image. With the default profile Rust is installed as if it’s on a development machine. The minimal profile is for servers / apps.
--target x86_64-unknown-linux-gnu thing you can skip but I prefer to be explicit – 50/50, your call.
More info here: Profiles - The rustup book