leptos-rs / book

The home for the Leptos book, which can be found deployed at https://book.leptos.dev
MIT License
59 stars 58 forks source link

Use a base OS to run binary instead of Rust runtime #67

Closed Wollaston closed 3 months ago

Wollaston commented 4 months ago

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.

gbj commented 3 months ago

Thanks!