-
Notifications
You must be signed in to change notification settings - Fork 8.1k
docs: Add a section in the Rust guide to use DHI #23728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@edithturn I mirrored Rust images to my account, and the actual language version is 1.91.1. Maybe the guide should be updated to it? |
Hi @igor-alexandrov , thank you for the review and for pointing this out! 🙌 While testing, I also noticed that one of the dependencies in the Hello World base example (used by this part of the docs) didn’t compile with Thanks again for the feedback, I really appreciate it! |
|
Thanks @edithturn. Sorry, we had to quietly pause all reviews/changes for the surprise DHI free updates. Can you help update this based on that? |
|
Hi @craig-osterhout, I updated the documentation with public Docker Hardened Images. I compiled and tested everything, and it is working fine! Appreciate your time for reviewing! Thanks! |
craig-osterhout
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating, @edithturn. I left a couple suggestions.
| To pull Docker Hardened Images, authenticate once with Docker: | ||
|
|
||
| ```bash | ||
| docker login |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| docker login | |
| docker login dhi.io |
| Use DHIs from the dhi.io registry, for example: | ||
|
|
||
| ```bash | ||
| FROM dhi.io/rust:${RUST_VERSION}-alpine AS build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example, so not critical, but no tag with -alpine exists. Suggest:
FROM dhi.io/rust:${RUST_VERSION}-alpine3.22-dev AS build
| ################################################################################ | ||
| # Create a stage for building the application. | ||
|
|
||
| FROM rust:${RUST_VERSION}-alpine AS build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, but it looks like this should be the dhi example.
FROM dhi.io/rust:${RUST_VERSION}-alpine3.22-dev AS build
|
|
||
| ################################################################################ | ||
| # Create a new stage for running the application that contains the minimal | ||
| FROM alpine:3.18 AS final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, but suggest using a dhi as the runtime also.
FROM dhi.io/alpine-base:3.22 AS final
Could probably also use static dhi with the compiled binary for even less attack surface.
| Docker Hardened Images (DHIs) are minimal, secure, and production-ready base images maintained by Docker. | ||
| They help reduce vulnerabilities and simplify compliance. For more details, see [Docker Hardened Images](/dhi/). | ||
|
|
||
| {{< tabs >}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there's only one tab. Suggest using 2 tabs, one for doi/docker init, and one for dhi. For example, see the bun guide at https://raw.githubusercontent.com/docker/docs/refs/heads/main/content/guides/bun/containerize.md
Description
Updated the Rust language guide to include Docker Hardened Images (DHI).
Changes include:
This follows the same structure used in the Bun and Ruby DHI updates.
Reviews