Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Add note about docker architecture on Pulumi Deployment #2997

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sicarul
Copy link
Contributor

@sicarul sicarul commented Jun 7, 2023

Description

Adding note to specify how to build cross-platform docker images in Pulumi Deployments

Checklist:

  • I have reviewed the style guide.
  • I have manually confirmed that all new links work.
  • I added aliases (i.e., redirects) for all filename changes.
  • If making css changes, I rebuilt the bundle.

@pulumi-bot
Copy link
Collaborator

Your site preview for commit c353341 is ready! 🎉

http://pulumi-hugo-origin-pr-2997-c3533411.s3-website.us-west-2.amazonaws.com.


### Building Docker images for another architecture

By default, the deployment executor will only build Docker images for the x86_64 architecture, if you need to build images for another architecture (e.g. linux/arm64), you can add the architecture as a pre-run command such as:
Copy link
Contributor

@AaronFriel AaronFriel Jun 7, 2023

Choose a reason for hiding this comment

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

This isn't quite right, to execute run steps in a Dockerfile for another architecture requires an emulator to be installed. There are many tools (Rust, Go, C with the appropriate tools installed, etc.) that support cross-compilation and can build images for a target architecture without any emulator by using FROM --platform=$BUILDPLATFORM ... to run natively, and compiling a statically linked binary for the target.

Suggest a few changes:

  1. Saying that the deployment engine uses x86-64 (aka linux/amd64) hosts.
  2. Suggest that if users are building binaries for another platform, whether via the Command provider, Docker, they reference the documentation for building cross platform tools.
  3. Suggest the command below to install emulators for Docker, linking to Docker documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think i oversimplified this topic because i don't fully understand it, i think it'll be better if i close this PR and let someone else that knows better to write it, the suggestions you sent are longer than the text i wrote, i'm clearly out of my area of expertise here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sicarul were you able to update this section of the PR? I see this has been re-opened.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EvanBoyle told me to send the PR through Slack, i sent the updated changes merging the latest version

@sicarul
Copy link
Contributor Author

sicarul commented Jun 7, 2023

Closing in favor of a better alternative by someone who better understands this topic, sorry!

@sicarul sicarul closed this Jun 7, 2023
@github-actions
Copy link

github-actions bot commented Jun 7, 2023

Site previews for this pull request have been removed. ✨

@pulumi-bot
Copy link
Collaborator

Your site preview for commit 67df465 is ready! 🎉

http://pulumi-hugo-origin-pr-2997-67df4650.s3-website.us-west-2.amazonaws.com.

@sicarul sicarul requested review from EvanBoyle and removed request for susanev September 22, 2023 18:17
@desteves desteves added the area/docs Improvements or additions to documentation label Oct 25, 2023
@cnunciato
Copy link
Contributor

cnunciato commented Oct 26, 2023

I think we need someone to provide a bit more detail so we can bring this to completion. It sounds like we're close, but I want to be sure I understand what led up to this so we don't overcomplicate.

@sicarul Was the problem that your Pulumi program was producing (when running in Deployments) an x86_64 Docker image, but you needed the image to be built for some other platform? If so, I think Friel's #1 and #2 suggestions above are probably enough (i.e., to call this out -- as it sounds like a fairly common scenario -- and then essentially point users to the Docker docs for how to address it). Would you agree?

@sicarul
Copy link
Contributor Author

sicarul commented Oct 27, 2023

@cnunciato yes, i solved being able to build in arm64 by using the command proposed in the PR, which allows to host ECS Fargate services using the cheaper graviton processors. I don't see how linking to Docker docs will solve this question for future users that have this problem, is there a link that plainly explains the same solution i used, or any other that also works?

I don't understand why we can't simply put the command that we know solves this problem in the docs.

@cnunciato
Copy link
Contributor

cnunciato commented Oct 27, 2023

I don't understand why we can't simply put the command that we know solves this problem in the docs.

Oh, I'm sorry! I didn't mean to imply that -- totally open to adding this, I'm just looking to understand what we're actually addressing. Your note made it sound like you weren't sure yourself, so combined with the feedback and the closing and reopening of the PR without more explanation, it seemed sensible to ask for a bit more info.

What you've got here essentially says, "If you want to build for another platform, run this command," so this could use some additional explanation, IMO. What does this command actually do? What is this third-party tool we're implicitly recommending users add to their pre-run scripts? Is it the only way to accomplish this, or is there another (e.g., more standard, non-third-party) option? We can certainly add this info of course, provided we understand and can explain what it is, what it does, and why you'd use it (vs. some other approach). Hence Friel's recommendations, I think -- which again make sense to me, with the exception of the emulator bit, which I admit is outside my experience with Docker.

Are you planning on applying any of these recommendations? If not, would you like us to pick it up from here?

@sicarul
Copy link
Contributor Author

sicarul commented Oct 27, 2023

@cnunciato as far as i know, this package that gets installed is a third party package, i've not seen it documented officially in Docker (but maybe i just didn't find it), I don't know much more than "add the emulator with this command and compiling to arm64 works on Pulumi Deploy", if someone else has a more detailed explanation i'm happy to have them edit this PR or open a new one, IMHO even a short note like the PR i sent is better than no guidance at all.

@sicarul
Copy link
Contributor Author

sicarul commented Apr 15, 2024

@cnunciato should we merge or close this PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants