bake: use shared session for local sources for multiple targets #2615
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #1377
fixes #92
depends on #2607Detect cases where multiple bake targets would use the same
local source. For such cases a separate session request is
made in addition to session per target and local source
is made available in that source as well.
The new sessionID is sent with the request so the frontend
can ask associate it with the local source it needs.
The sources are still available in the main request session
as well. This would be used if frontend ignores the local-sessionid
parameter and makes sure that old version continue working.
This requires BuildKit/Dockerfile frontend with moby/buildkit#5174 support to work.
Note that this only works if the targets are using the same files from local context. If they ask for a different set of files then still multiple transfers will happen(on the same session). Atm. Dockerfile will try to pull all the files it needs from build context with a single transfer because every extra transfer results in new disk scanning overhead from the client side.
@dgageot