devspace icon indicating copy to clipboard operation
devspace copied to clipboard

multi-arch builds

Open janrito opened this issue 1 year ago • 3 comments

Is your feature request related to a problem?
My dev machine is an ARM mac, the cluster runs on amd64. Currently I can't build the images locally if I want them to work on the cluster.

Which solution do you suggest?
Buildkit supports multi-arch images https://docs.docker.com/build/building/multi-platform/#multiple-native-nodes

Which alternative solutions exist?

Not aware of any

Additional context

I'd be really nice to just be able to:

images:
  test-application-image:
    image: acct.dkr.ecr.region.amazonaws.com/test-application-image
    dockerfile: app/Dockerfile
    context: app/
    buildKit:
      args: [--platform, 'linux/amd64,linux/arm64']

janrito avatar Mar 27 '24 17:03 janrito

+1

patrick-grapple avatar Jun 20 '24 15:06 patrick-grapple

+1

Did not expect to hit this issue when integrating multi arch builds in our system.

I don't understand where the issue is coming from. When specifying "--platform linux/amd64,linux/arm64" in buildKit.inCluster.createArgs and buildKit.args it complains about

ERROR: unknown flag: --platform linux/amd64,linux/arm64

But if I copy paste the command it prints it works and I cannot se any filtering of command line arguments in: https://github.com/devspace-sh/devspace/blob/main/pkg/devspace/build/builder/buildkit/buildkit.go

danielnilsson9 avatar Jun 28 '24 09:06 danielnilsson9

Ok this was an user error I quess. Multi arch builds works when value arguments are passed with --value=arg (NOTE: = instead of space between arg and value).

So this works:

buildKit:
  args:
    - "--platform=linux/amd64,linux/arm64"
  inCluster:
    createArgs: 
      - "--platform=linux/amd64,linux/arm64"

danielnilsson9 avatar Jun 28 '24 11:06 danielnilsson9