Skip to content

feat: add cli client support for image builds to enable buildkit#8772

Merged
reedham-aws merged 5 commits intodevelopfrom
feat-buildkit
Mar 10, 2026
Merged

feat: add cli client support for image builds to enable buildkit#8772
reedham-aws merged 5 commits intodevelopfrom
feat-buildkit

Conversation

@reedham-aws
Copy link
Contributor

@reedham-aws reedham-aws commented Mar 9, 2026

This PR is to merge the feature branch feat-buildkit to develop. Previously on that branch, we had approved the implmentation (#8661) and integration tests(#8689)

Which issue(s) does this change fix?

This PR will resolve (once released in 1.156.0) #3972 by adding support for using the Docker CLI directly.

Why is this change necessary?

Previously SAM CLI only used the docker-py SDK, which does not offer support for the BuildKit plugin. BuildKit offers support for different features like parallel builds for multi-stage builds, better cross-architecture builds, and efficient caching.

How does it address the issue?

Adds support to use the docker buildx and finch CLIs, which both natively support BuildKit. The feature is used like:

sam build --use-buildkit

What side effects does this change have?

Should be none, as this is an opt-in feature.

Mandatory Checklist

PRs will only be reviewed after checklist is complete

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

* feat: add build_client

* feat: add --use-buildkit option

* feat: use build client when building with images

* lint and format

* feat: add command to cli

* fix: use absolute path for dockerfile

* test: add unit test for build_client

* test: add unit test for build_context

* fix: additional test fixes

* fix: schema update

* fix: remove hardcoded unix pathseps

* fix: remove provenance and sbom from docker buildx

* fix: refactor code to use SDKBuildClient

This change also refactors a lot of docker specific things to be "container_client" rather than "docker_client".
In addition, moving from instantiating the image build client in build context to lazily doing it in the app builder.

* test: add additional unit tests

* fix: fix error handling in CLIBuildClient

* fix: reorder error handling in CLIImageBuilder
* test: add basic integration test

* test: more comprehensive integ tests

* test: add arm64 test and mark as tier1

* fix: update dockerfile error messages

* test: remove arm64 test

* fix: allow finch without sudo
@reedham-aws reedham-aws requested a review from a team as a code owner March 9, 2026 23:02
@github-actions github-actions bot added area/local/start-api sam local start-api command area/build sam build command area/local/invoke sam local invoke command area/local/start-invoke area/schema JSON schema file pr/internal labels Mar 9, 2026
@reedham-aws reedham-aws added this pull request to the merge queue Mar 10, 2026
Merged via the queue into develop with commit 3310e80 Mar 10, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build sam build command area/local/invoke sam local invoke command area/local/start-api sam local start-api command area/local/start-invoke area/schema JSON schema file pr/internal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants