[PR #2874] [MERGED] Rewrite Dockerfile with cargo-chef #3386

Closed
opened 2026-03-16 11:40:55 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/2874
Author: @divergentdave
Created: 3/19/2025
Status: Merged
Merged: 3/20/2025
Merged by: @divergentdave

Base: mainHead: david/conformance-hickory-cargo-chef


📝 Commits (4)

  • 55d7a69 Rewrite Dockerfile with cargo-chef
  • eec48f7 Change default value of DNSSEC_FEATURE
  • c9d4ef9 Remove unneeded packages
  • 554b0f0 Document why we need packages

📊 Changes

1 file changed (+38 additions, -17 deletions)

View changed files

📝 conformance/packages/dns-test/src/docker/hickory.Dockerfile (+38 -17)

📄 Description

This rewrites the Dockerfile used for Hickory DNS in conformance tests. It splits it into a multi-stage build, and uses cargo-chef to split building dependencies and building the final binary into separate image layers. This will allow the layer for building the dependencies to be reused in most situation, and it will also allow running apt-get install from the final stage in parallel with compilation in the earlier stages.

I also removed a cache mount for the target directory. This was not effective previously. I think this was likely because only the target directory was cached, and not the Cargo registry. I stopped building the dns binary, since it was not used. Note that rust:1-slim-bookworm includes the openssl CLI, but debian:bookworm-slim does not, so I had to additionally install that in the final stage. This is used for key generation when setting up configuration at runtime. I set some Cargo environment variables as well, to reduce binary size, and thus conserve cache space.

Edit: Nevermind, the dns binary is used in e2e-tests.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/2874 **Author:** [@divergentdave](https://github.com/divergentdave) **Created:** 3/19/2025 **Status:** ✅ Merged **Merged:** 3/20/2025 **Merged by:** [@divergentdave](https://github.com/divergentdave) **Base:** `main` ← **Head:** `david/conformance-hickory-cargo-chef` --- ### 📝 Commits (4) - [`55d7a69`](https://github.com/hickory-dns/hickory-dns/commit/55d7a690c8699322af802a0b3210c0e8fc36126b) Rewrite Dockerfile with cargo-chef - [`eec48f7`](https://github.com/hickory-dns/hickory-dns/commit/eec48f77fc7b12587146b391c355dba62060c060) Change default value of DNSSEC_FEATURE - [`c9d4ef9`](https://github.com/hickory-dns/hickory-dns/commit/c9d4ef9fc185f14efd594cb72406e1fb3a24d594) Remove unneeded packages - [`554b0f0`](https://github.com/hickory-dns/hickory-dns/commit/554b0f08638ab18f56350fb0474575daf7f35d3a) Document why we need packages ### 📊 Changes **1 file changed** (+38 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `conformance/packages/dns-test/src/docker/hickory.Dockerfile` (+38 -17) </details> ### 📄 Description This rewrites the Dockerfile used for Hickory DNS in conformance tests. It splits it into a multi-stage build, and uses `cargo-chef` to split building dependencies and building the final binary into separate image layers. This will allow the layer for building the dependencies to be reused in most situation, and it will also allow running `apt-get install` from the final stage in parallel with compilation in the earlier stages. I also removed a cache mount for the target directory. This was not effective previously. I think this was likely because only the target directory was cached, and not the Cargo registry. ~~I stopped building the `dns` binary, since it was not used.~~ Note that `rust:1-slim-bookworm` includes the `openssl` CLI, but `debian:bookworm-slim` does not, so I had to additionally install that in the final stage. This is used for key generation when setting up configuration at runtime. I set some Cargo environment variables as well, to reduce binary size, and thus conserve cache space. Edit: Nevermind, the `dns` binary is used in `e2e-tests`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:40:55 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#3386
No description provided.