Improve Dockerfile #2
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi !
This PR implements several best practices for the Dockerfile, mainly a multi-stage build process to significantly reduce the final image size (from 1.4GB to 209MB while building with containerd on a Windows host, a 85% reduction) and build time. The patched DHCP client is built in a transient builder stage, and then copied in a clean Debian 13 slim base.
It is building fine on my Windows system, but I have no way to currently test that it still runs correctly when launched, could you have a go at it and let me know if there is no regression ?
Highlights
debian:13-slim, and both base images now use specific SHA256 digests for enhanced security and reproducibility. The builder stage usesdebian:13.RUNcommands have been chained together using&& \to reduce the number of Docker image layers. Aggressive cleanup steps, includingapt-get cleanandrm -rf /var/lib/apt/lists/*, are now integrated into the installation processes to minimize image bloat.dhclient-orange-patchednow usesmake -j$(( $(nproc) + 1 ))for parallel compilation, andgit cloneuses--depth 1for faster cloning. Build-time dependencies likebuild-essentialandgitare confined to the builder stage.ARG DEBIAN_FRONTEND=noninteractiveinstruction has been added to both build stages to prevent interactive prompts during package installations, ensuring a fully automated build.