Skip to content

Conversation

@Harvester57
Copy link
Contributor

@Harvester57 Harvester57 commented Dec 10, 2025

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

  • Multi-Stage Build Implementation: The Dockerfile has been refactored to use a multi-stage build pattern, separating the build environment (builder stage) from the final runtime environment. This significantly reduces the final image size by not including build-time dependencies.
  • Optimized Base Images: The base image for the final stage has been switched to debian:13-slim, and both base images now use specific SHA256 digests for enhanced security and reproducibility. The builder stage uses debian:13.
  • Consolidated RUN Commands and Cleanup: Multiple RUN commands have been chained together using && \ to reduce the number of Docker image layers. Aggressive cleanup steps, including apt-get clean and rm -rf /var/lib/apt/lists/*, are now integrated into the installation processes to minimize image bloat.
  • Efficient Build Process: The build process for dhclient-orange-patched now uses make -j$(( $(nproc) + 1 )) for parallel compilation, and git clone uses --depth 1 for faster cloning. Build-time dependencies like build-essential and git are confined to the builder stage.
  • Non-Interactive Package Installation: The ARG DEBIAN_FRONTEND=noninteractive instruction has been added to both build stages to prevent interactive prompts during package installations, ensuring a fully automated build.

@Raraph84
Copy link
Owner

It seems good to me but I won't have the time to test this before january, I will update here when I've tested it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants