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

Optimize docker requests for local builds #34

Merged
merged 2 commits into from
Jul 13, 2023

Conversation

pipex
Copy link
Contributor

@pipex pipex commented Jul 11, 2023

This PR adds some optimizations for requests going over the docker socket during local builds.

  • It adds a filter to avoid querying the registry for the manifest of images created during intermediate build stages.
  • It removes cachefrom from the options passed to the pull operation, as there is evidence to suggest that the cache option getting too big would be the cause of builds terminating without error on Suggestion: Make it accept the API key when it's in the C&P buffer balena-io/balena-cli#216. The cachefrom option is not used by Docker's ImageCreate endpoint, so removing should have no side effects.

Change-type: patch

This removes unnecessary queries to the registry for intermediate
stage images in the dockerfile. Querying the registry for these images
would fail in the best case or could cause false positives in the worst
case.

This commit adds an additional filter during parsing of the dockerfile
to remove any intermediate stages from the query list.

Change-type: patch
This option is not used by the [Docker
API](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageCreate).

As the cache can get really big, depending on how the cache list is
obtained, this may mean sending a huge query string over the local
network. There is good evidence to suggest that this could be the cause of
balena-io/balena-cli#2165, which would cause the query string to over
the 1MB limit set by [Golang's net/http server](https://pkg.go.dev/net/http#Server).

Change-type: patch
@flowzone-app flowzone-app bot enabled auto-merge July 11, 2023 14:32
@pipex pipex changed the title Improvements for local builds Optimize docker requests for local builds Jul 11, 2023
@pipex pipex requested a review from dfunckt July 11, 2023 14:39
@pipex
Copy link
Contributor Author

pipex commented Jul 13, 2023

I self-certify!

@flowzone-app flowzone-app bot merged commit d88a88b into master Jul 13, 2023
47 checks passed
@flowzone-app flowzone-app bot deleted the local-build-terminates branch July 13, 2023 23:22
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.

1 participant