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

local image build: support arm and amd64 #12750

Closed
heidongxianhua opened this issue Mar 6, 2024 · 2 comments · Fixed by #12754
Closed

local image build: support arm and amd64 #12750

heidongxianhua opened this issue Mar 6, 2024 · 2 comments · Fixed by #12754
Labels
area/build Build or GithubAction/CI issues area/contributing Contributing docs, ownership, etc. Also devtools like devcontainer and Nix good first issue Good for newcomers solution/suggested A solution to the bug has been suggested. Someone needs to implement it. type/feature Feature request

Comments

@heidongxianhua
Copy link
Contributor

Summary

What change needs making?
Now, if we build controller image, the imgae Architecture will be same as your machine, it can not use on arm and amd64 at the same time. so we want to change.

Use Cases

When would you use this?


Message from the maintainers:

Love this enhancement proposal? Give it a 👍. We prioritize the proposals with the most 👍.

@heidongxianhua heidongxianhua added the type/feature Feature request label Mar 6, 2024
@Joibel
Copy link
Member

Joibel commented Mar 6, 2024

Are you asking for the ability to choose which single architecture to build for, or the ability to build multiple architectures into a single image with manifest?
Is this just for the docker images?
As a temporary workaround for building images you can set one or more platforms in the Makefile with

%-image:
	[ ! -e dist/$* ] || mv dist/$* .
	docker buildx build \
		--platform linux/amd64,linux/arm64 \
		--build-arg GIT_COMMIT=$(GIT_COMMIT) \
		--build-arg GIT_TAG=$(GIT_TAG) \
		--build-arg GIT_TREE_STATE=$(GIT_TREE_STATE) \
		-t $(IMAGE_NAMESPACE)/$*:$(VERSION) \
		--target $* \
		--load \
		 .

The critical changed line there being --platform.

We'd accept a PR for formalizing this if you want to do it, so long as it only built for the "same as your machine" in the default case. You could set an environment variable to override this behavior.

@Joibel Joibel added good first issue Good for newcomers area/build Build or GithubAction/CI issues labels Mar 6, 2024
@agilgur5 agilgur5 added area/contributing Contributing docs, ownership, etc. Also devtools like devcontainer and Nix solution/suggested A solution to the bug has been suggested. Someone needs to implement it. labels Mar 6, 2024
@agilgur5 agilgur5 changed the title image build: support arm and amd64 local image build: support arm and amd64 Mar 6, 2024
@heidongxianhua
Copy link
Contributor Author

heidongxianhua commented Mar 7, 2024

yeah, I have test it locally, when I add the arg --platform linux/amd64,linux/arm64, it will failed with error ERROR: docker exporter does not currently support exporting manifest lists, It seems that the limitation is combination of --load and multiple values to --platform. Eg. --platform linux/arm64 --load works fine. So I solve it according to docker/buildx#59 to set * enable "User containerd for pulling and storing images" in Settings > Features in development > Beta features, it works but need more time to build images. And I will give a PR here.#12754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Build or GithubAction/CI issues area/contributing Contributing docs, ownership, etc. Also devtools like devcontainer and Nix good first issue Good for newcomers solution/suggested A solution to the bug has been suggested. Someone needs to implement it. type/feature Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants