devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.17k stars 351 forks source link

multi-arch builds #2826

Open janrito opened 3 months ago

janrito commented 3 months ago

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']
patrick-grapple commented 1 week ago

+1

danielnilsson9 commented 1 day ago

+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 commented 1 day ago

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"