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 #802

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

dlaw4608
Copy link
Contributor

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.

@dlaw4608 dlaw4608 self-assigned this Aug 14, 2024
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.74%. Comparing base (ece13e8) to head (e9da3c3).
Report is 165 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #802      +/-   ##
==========================================
+ Coverage   80.20%   81.74%   +1.53%     
==========================================
  Files          64       76      +12     
  Lines        4492     6114    +1622     
==========================================
+ Hits         3603     4998    +1395     
- Misses        600      760     +160     
- Partials      289      356      +67     
Flag Coverage Δ
bare-k8s-integration 4.48% <ø> (?)
controllers-integration 71.75% <ø> (?)
gatewayapi-integration 10.89% <ø> (?)
integration ?
istio-integration 56.17% <ø> (?)
unit 31.45% <ø> (+1.42%) ⬆️

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

Components Coverage Δ
api/v1beta1 (u) 71.42% <ø> (ø)
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) 81.88% <81.96%> (+5.08%) ⬆️

see 42 files with indirect coverage changes

Copy link
Contributor

@KevFan KevFan left a comment

Choose a reason for hiding this comment

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

Nice! This is quite an improvement, reducing the time from 15 minutes to 2.5 minutes for building the image of the Kuadrant Operator, which should enhance the development and upstream release feedback loop. Great work! 👍

Changes looks good to me! However, for some reason, the image build workflow was not run on this PR for some reason 🤔 Maybe amend the commit message and do a push again? It'll be nice to see that the image build github action completing successfully before merging this

… dependancy

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

@KevFan KevFan left a comment

Choose a reason for hiding this comment

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

Verified this user guide using the quay.io/kuadrant/kuadrant-operator:crosscompile image that was built from the github action from this PR, and it was working as expected 👍

Changes looks good to me 💯

@dlaw4608 dlaw4608 merged commit ec17659 into main Aug 15, 2024
27 checks passed
@eguzki eguzki deleted the crosscompile branch August 20, 2024 09:53
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
Status: Done
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
2 participants