The Rust runtime for a docker image is large as it includes the language's tooling. It is not needed to run a Rust binary file. This replaces the full runtime with a base OS (Debian) in order to reduce the size of the Docker image. As an example, this reduced the Docker image size of my website from ~2GB to ~100MB.
I am not sure if installing 'openssl' and 'ca-certificates' is strictly required, but since the intention of this Dockerfile is to create a Docker image for a web app, and the basis for the update is from a book on Rust web apps, I thought it made sense to leave in. Open to any thoughts on that. Many thanks.
The Rust runtime for a docker image is large as it includes the language's tooling. It is not needed to run a Rust binary file. This replaces the full runtime with a base OS (Debian) in order to reduce the size of the Docker image. As an example, this reduced the Docker image size of my website from ~2GB to ~100MB.
This is adapted from the zero2prod Dockerfile.
I am not sure if installing 'openssl' and 'ca-certificates' is strictly required, but since the intention of this Dockerfile is to create a Docker image for a web app, and the basis for the update is from a book on Rust web apps, I thought it made sense to leave in. Open to any thoughts on that. Many thanks.