Overview
Learn how to optimize Rust Docker builds, reducing image sizes from over 2GB to just 27MB and cutting build times from minutes to seconds. Explore multi-stage builds, Google's Distroless images, and Cargo Chef for efficient dependency management in this comprehensive tutorial. Master techniques for creating secure, lightweight Rust Docker images using least privilege users and discover how to overcome slow compilation issues. Follow along as an Actix-web server is used to demonstrate these powerful optimization strategies for Rustlang projects.
Syllabus
- introduction
- create an actix-web server
- create our dockerfile
- create a .xdockerignore file
- building our docker image
- running our docker container
- slow compilation issues with docker and rust
- creating smaller images with multi-stage
- google distroless production images
- separating dependencies from application build
- building dependencies with cargo-chef
- super fast compilation of our docker image
- least privilege rust docker images
- conclusion
Taught by
Chris Hay