-
Notifications
You must be signed in to change notification settings - Fork 2.1k
build: enable platform flag for build if buildkit #1740
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,7 +146,16 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command { | |
| flags.StringVar(&options.imageIDFile, "iidfile", "", "Write the image ID to the file") | ||
|
|
||
| command.AddTrustVerificationFlags(flags, &options.untrusted, dockerCli.ContentTrustEnabled()) | ||
| command.AddPlatformFlag(flags, &options.platform) | ||
|
|
||
| flags.StringVar(&options.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable") | ||
| // Platform is not experimental when BuildKit is used | ||
| buildkitEnabled, err := command.BuildKitEnabled(dockerCli.ServerInfo()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is buggy: |
||
| if err == nil && buildkitEnabled { | ||
| flags.SetAnnotation("platform", "version", []string{"1.38"}) | ||
| } else { | ||
| flags.SetAnnotation("platform", "version", []string{"1.32"}) | ||
| flags.SetAnnotation("platform", "experimental", nil) | ||
| } | ||
|
|
||
| flags.BoolVar(&options.squash, "squash", false, "Squash newly built layers into a single new layer") | ||
| flags.SetAnnotation("squash", "experimental", nil) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you document this environment-variable? https://github.com/docker/cli/blob/master/docs/reference/commandline/cli.md#environment-variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. Note that this PR does not add this env, but just moves around the code.