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

Multi-platform build targeting both amd64 and arm64 #605

Closed
odsod opened this issue Feb 20, 2022 · 5 comments
Closed

Multi-platform build targeting both amd64 and arm64 #605

odsod opened this issue Feb 20, 2022 · 5 comments

Comments

@odsod
Copy link

odsod commented Feb 20, 2022

What are you trying to do?

Trying to set up a build to output multi-platform images for both linux/arm32v5 and linux/amd64 for the same main entrypoint.

I can configure one or the other by changing the default base image between gcr.io/distroless/static and gcr.io/distroless/static:latest-arm64, but that requires changing the base image configuration between the build steps.

What did you expect?

Lacking a distroless/static image that supports all platforms, the ability to configure different base images for different platforms in the same build.

@imjasonh
Copy link
Member

Yeah, this is a known annoyance. Some discussion and prototyping in #475

Tekton also does this, to combine distroless and a Windows base image as a pre-step, but it's definitely annoying.

I think we could figure out how to make it work in ko directly.

@imjasonh
Copy link
Member

Actually: Does this work for you?

ko publish ./cmd/app --platform=linux/amd64,linux/arm

If distroless/static supports armv5 I'd expect this to work.

@odsod
Copy link
Author

odsod commented Feb 20, 2022

@imjasonh Thank you, that seems to work!

So if I read this PR correctly I'm supposed to provide the ARM instruction set as part of the platform, #239 - but that leads to a base image that is not included in the distroless/static metadata?

So to solve this I can configure the build to target linux/arm and manually set GOARM=5?

@imjasonh
Copy link
Member

You can specify linux/arm/v5 to differentiate between variants if the base image specifies multiple (linux/arm/v5, v7, whatever). That PR means that the base image's detected/supported variant would be used to further specify better go compilation support if it can find it (using GOARM).

Since distroless only currently provides a generic linux/arm, this is moot. If you want to use another base image, eg alpine, you could.

If you want to support linux/arm via distroless/static and other variants via eg alpine, you could combine a base image together, like Tekton does as described in the issue above, but that's cumbersome. ko could do better.

@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Keep fresh with the 'lifecycle/frozen' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants