Skip to content

Speedup the building of Docker images #18038

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

Merged
merged 8 commits into from
Feb 19, 2025
Merged

Conversation

sandhose
Copy link
Member

@sandhose sandhose commented Dec 18, 2024

This is a split off #18033

This uses a few tricks to speed up the building of docker images:

  • This switches to use uv pip install instead of pip install. This saves a bunch of time, especially when cross-compiling
  • I then looked at what packages were not using binary wheels: I upgraded MarkupSafe to have binaries for py3.12, and got back to Python 3.12 because hiredis didn't have builds for py3.13 with the version we were using
  • The generation of the requirements.txt is arch-agnostic, so I've switched this one to run on the build architecture, so that both arch can share it
  • The download of runtime depdendencies can be done on the build architecture through manual apt-get download plus dpkg --extract
  • We were using -slim images, but still installed a bunch of -dev dependencies. Turns out, all the dev dependencies were already installed in the non-slim image, which saves a bunch of time as well

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

A few very minor things, but otherwise this LGTM. This included a few tricks I wasn't aware of myself. Thanks for taking the time to go through and do this!

Needs a git revert d113209 before merge, of course.

@sandhose sandhose force-pushed the quenting/docker/speedup branch from ea7a677 to d02f0cf Compare February 18, 2025 15:49
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

LGTM after temp commit revert. Thanks!

@sandhose sandhose enabled auto-merge (squash) February 19, 2025 08:11
@sandhose sandhose merged commit 1525a3b into develop Feb 19, 2025
40 checks passed
@sandhose sandhose deleted the quenting/docker/speedup branch February 19, 2025 10:55
AndrewFerr added a commit to AndrewFerr/sygnal that referenced this pull request Apr 4, 2025
Analogous to element-hq/synapse#18038, switch from `pip install` to
`uv pip install`, and use the build target for arch-agnostic stages.
Also define build arguments for otherwise hardcoded values.
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.

3 participants