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

chore: multi-arch support with buildx in all Dockerfiles #5273

Merged
merged 47 commits into from
Sep 6, 2023

Conversation

kahirokunn
Copy link
Contributor

@kahirokunn kahirokunn commented Oct 13, 2022

Proposed Changes

I deployed a docker image built on M1 mac to an intel cluster and got a cpu architecture error.
Now that support for both amd and arm is expanding, I think it is better for users to use buildx to build both to try out the sample.

@netlify
Copy link

netlify bot commented Oct 13, 2022

Deploy Preview for knative ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9a3b5b4
🔍 Latest deploy log https://app.netlify.com/sites/knative/deploys/64e2ef93a04b1b00083f15f6
😎 Deploy Preview https://deploy-preview-5273--knative.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@knative-prow
Copy link

knative-prow bot commented Oct 13, 2022

Welcome @kahirokunn! It looks like this is your first PR to knative/docs 🎉

@knative-prow knative-prow bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 13, 2022
@abrennan89
Copy link
Contributor

@knative/serving-reviewers

# Push the container to docker registry.
docker push "{username}/grpc-ping-go"
# Build and push the container on your local machine.
docker buildx build --platform linux/arm64,linux/amd64 -t "{username}/grpc-ping-go" --push .
Copy link
Contributor

Choose a reason for hiding this comment

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

The new command failed for me with the following output:

[+] Building 0.0s (0/0)                                                                                  
ERROR: multiple platforms feature is currently not supported for docker driver. 
Please switch to a different driver (eg. "docker buildx create --use")

whereas the original commands worked without issue. If we're going to update it to use buildx, we'll need some more set up info since it doesn't work out of the box.

Copy link
Member

Choose a reason for hiding this comment

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

I think adding a link to the buildx should be enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If correct, consolidate into one commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I think I'd rather leave the default as-is and provide a link to buildx for those who need to do a multiarch build (which won't be everyone)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you let people use buildx from the beginning, the container image will run on many people's PCs.
You will not have to worry about CPU architecture errors.
Therefore, buildx is also a good choice.

@github-actions
Copy link

github-actions bot commented Feb 4, 2023

This Pull Request is stale because it has been open for 90 days with
no activity. It will automatically close after 30 more days of
inactivity. Reopen with /reopen. Mark as fresh by adding the
comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 4, 2023
@kahirokunn
Copy link
Contributor Author

keep

@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 24, 2023
@dprotaso
Copy link
Member

The Dockerfile needs to be updated to support multi arch first

ie.
098a9da

@skonto
Copy link
Contributor

skonto commented Jul 13, 2023

@kahirokunn gentle ping, are you still planning to update it?

@knative-prow knative-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 13, 2023
@kahirokunn
Copy link
Contributor Author

@dprotaso @skonto I have addressed the points raised. How about now?

@skonto
Copy link
Contributor

skonto commented Jul 28, 2023

I will test the updates thanks @kahirokunn. We do not want this for the rest of the samples? I think we need proper image build instructions for all no?

@kahirokunn
Copy link
Contributor Author

Do you wish to buildx all images in this repository?

@skonto
Copy link
Contributor

skonto commented Jul 31, 2023

It would be nice to have build options or maybe a separate page for building alternatives instead of copying the same command everywhere.

@skonto
Copy link
Contributor

skonto commented Aug 4, 2023

@dprotaso @psschwei wdyth? Should we re-write docs also to include builds with docker buildx for the other samples too?

@psschwei
Copy link
Contributor

psschwei commented Aug 4, 2023

@dprotaso @psschwei wdyth? Should we re-write docs also to include builds with docker buildx for the other samples too?

I think I'm still slightly in favor of leaving things as is, with maybe a link out to buildx and/or other alternatives (with the view towards minimizing changes as these samples aren't really actively maintained). But, that said, I don't feel particularly strongly about it (I also don't use a Mac), so if we do decide we should update, that's fine too.

But if we do update, we should update all, I think.

@kahirokunn
Copy link
Contributor Author

@psschwei Okay, I will update all.

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 21, 2023
@kahirokunn kahirokunn changed the title chore: use buildx to build grpc-ping-go chore: multi-arch support with buildx in all Dockerfiles Aug 21, 2023
@kahirokunn
Copy link
Contributor Author

done. how about now?

@kahirokunn
Copy link
Contributor Author

@psschwei I would appreciate a review before conflicts arise. thx.

@psschwei
Copy link
Contributor

psschwei commented Sep 6, 2023

Sorry about that, I missed the notification for this one one...

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 6, 2023
@knative-prow
Copy link

knative-prow bot commented Sep 6, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kahirokunn, psschwei

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 6, 2023
@knative-prow knative-prow bot merged commit 8e917ed into knative:main Sep 6, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. hacktoberfest-accepted lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants