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

Add support for --platform flag in docker-build task #3874

Merged
merged 3 commits into from
Mar 31, 2023
Merged

Conversation

bwateratmsft
Copy link
Collaborator

@bwateratmsft bwateratmsft commented Mar 20, 2023

Closes #3870.

alexyaang
alexyaang previously approved these changes Mar 20, 2023
karolz-ms
karolz-ms previously approved these changes Mar 20, 2023
@@ -52,6 +52,7 @@
"vscode-docker.tasks.docker-build.dockerBuild.dockerfile": "Path to the Dockerfile used for the build.",
"vscode-docker.tasks.docker-build.dockerBuild.labels.description": "Labels applied to the Docker image used for debugging.",
"vscode-docker.tasks.docker-build.dockerBuild.labels.includeDefaults": "Whether to include the default set of labels defined by the Docker extension",
"vscode-docker.tasks.docker-build.dockerBuild.platform": "Target platform for the image build",
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this option support just single platform, or is multi-platform build possible? Perhaps it is worth to clarify.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. I originally thought to do multiple since that's what I saw in examples, but upon closer inspection, that applies only to the docker buildx build command--not the regular docker build command, which only accepts a single platform option.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also, in tasks.json it will give a warning squiggle if you try to give an array instead of a single value.

Copy link
Member

Choose a reason for hiding this comment

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

You are right @bwateratmsft. It is one step even more nuanced than that.

Behavior of buildx:

  • Doesn't publish images to the image cache, by default.
  • Only supports publishing images to the cache when a single platform is set.

AFAICT, the multi-platform option (which is awesome!) is intended for direct push to registry. That's what I've used it for. As a side-note, when used correctly, you end up with --pull --push together. I find that to be pretty funny each time I see it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

Copy link
Member

Choose a reason for hiding this comment

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

Yup. That's the one.

@bwateratmsft bwateratmsft marked this pull request as ready for review March 23, 2023 14:22
@bwateratmsft bwateratmsft requested a review from a team as a code owner March 23, 2023 14:22
@bwateratmsft bwateratmsft dismissed stale reviews from karolz-ms and alexyaang via 4dcf9c6 March 24, 2023 13:38
@bwateratmsft bwateratmsft merged commit 00e08a8 into main Mar 31, 2023
@bwateratmsft bwateratmsft deleted the bmw/platforms branch March 31, 2023 15:34
@microsoft microsoft locked and limited conversation to collaborators May 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable specifying a platform for build
5 participants