Skip to content
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

Transition to Cross-Compilation for faster Docker Build Times #790

Closed
wants to merge 1 commit into from

Conversation

dlaw4608
Copy link
Contributor

@dlaw4608 dlaw4608 commented Jul 30, 2024

closes #787

This pull request introduces significant improvements to the Docker build process by implementing cross-compilation.

Building arm64 image via QEMU takes over 15 mins on github actions, making it slow to build for development.

image

Building the image via cross compile dropped this build time to 2 min 30

image

Changes Made

  1. Dockerfile Updates:

    • Introduced cross-compilation support by using ARG TARGETARCH.
    • Utilized --platform=$BUILDPLATFORM for multi-platform builds with Docker Buildx.
  2. Workflow File:

    • Updated the workflow to leverage Docker Buildx for building and pushing images to multiple platforms (linux/amd64, linux/arm64).
    • Removed reliance on QEMU emulation, significantly speeding up the build process.

Benefits

  • Faster Build Times: The new build process reduces the time from approximately 16 minutes to just 2 minutes and 30 seconds, representing an almost 8x improvement.
  • Optimised Build Efficiency: Reduces overhead and simplifies the build process by eliminating the need for emulation.

Copy link

codecov bot commented Jul 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.89%. Comparing base (ece13e8) to head (96b0fcc).
Report is 163 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #790      +/-   ##
==========================================
+ Coverage   80.20%   81.89%   +1.68%     
==========================================
  Files          64       76      +12     
  Lines        4492     6114    +1622     
==========================================
+ Hits         3603     5007    +1404     
- Misses        600      755     +155     
- Partials      289      352      +63     
Flag Coverage Δ
bare-k8s-integration 4.48% <0.00%> (?)
controllers-integration 71.73% <100.00%> (?)
gatewayapi-integration 10.99% <0.00%> (?)
integration ?
istio-integration 56.11% <0.00%> (?)
unit 31.45% <0.00%> (+1.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api/v1beta1 (u) 71.42% <55.55%> (ø)
api/v1beta2 (u) 85.35% <80.00%> (-6.08%) ⬇️
pkg/common (u) 88.13% <ø> (-0.70%) ⬇️
pkg/istio (u) 72.50% <ø> (-1.41%) ⬇️
pkg/log (u) 94.73% <ø> (ø)
pkg/reconcilers (u) ∅ <ø> (∅)
pkg/rlptools (u) 83.64% <ø> (+4.19%) ⬆️
controllers (i) 82.22% <83.91%> (+5.42%) ⬆️
Files Coverage Δ
controllers/dnspolicy_status.go 82.02% <100.00%> (-4.35%) ⬇️

... and 42 files with indirect coverage changes

…for the Quay.io Kuadrant Operator Registry

Added sign-off

Signed-off-by: dlaw4608 <dlawton@redhat.com>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase issue? I dont think this file and the files changes in tests/common/dnspolicy should be part of this PR 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I must have squashed @makslion's commit into my own, will fix.

@dlaw4608 dlaw4608 closed this Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request size/small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimise Docker Build Time by Using Cross-Compilation Instead of QEMU for Multi-Architecture Builds
3 participants