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

dockerfile: show target platform on cross compiling #2576

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

tonistiigi
Copy link
Member

On cross-compilation this PR now shows both build and target platform on progressbar, not only the platform or the current stage.

When both platforms have the same OS it is only shown once for less verbosity.

 => [linux/arm64 2/3] RUN apk add vim                                                                                                                         2.7s
 => [linux/arm64 3/3] RUN sleep 1                                                                                                                             1.3s
 => [linux/arm64->amd64 3/3] RUN sleep 1                                                                                                                      1.3s
 => [linux/arm64->windows/amd64 3/3] RUN sleep 1                                                                                                              1.3s

Signed-off-by: Tonis Tiigi [email protected]

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

Neat! I had exactly this issue to recognize which target failed during the cross compilation.

case "TARGETPLATFORM":
p, err := platforms.Parse(parts[1])
if err != nil {
continue
Copy link
Member

Choose a reason for hiding this comment

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

Why ignore this err?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a convention. A Dockerfile might be just using ARG TARGETPLATFORM with a completely custom value definition. We shouldn't fail the build in this case if we don't understand this value.

I can add a comment for that if you like.

@tonistiigi tonistiigi merged commit 7766209 into moby:master Jan 26, 2022
@crazy-max crazy-max added this to the v0.10.0 milestone Feb 4, 2022
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.

3 participants