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

ARM support for nodejs buildpacks #995

Open
18 tasks
Tracked by #312
c0d1ngm0nk3y opened this issue Dec 6, 2024 · 7 comments
Open
18 tasks
Tracked by #312

ARM support for nodejs buildpacks #995

c0d1ngm0nk3y opened this issue Dec 6, 2024 · 7 comments

Comments

@c0d1ngm0nk3y
Copy link

c0d1ngm0nk3y commented Dec 6, 2024

Describe the Enhancement

Currently, the nodejs buildpack does not support building on arm. The java buildpack does, so the tools buildpacks used by both (e.g. ca-certificates) should be already prepared.

This is meant to be a checklist of things to adress in order to support arm with a nodejs buildpack.

Possible Solution

  • packit supports architecture when downloading dependencies : Support architecture for dependencies packit#618 (Enable architecture specific dependencies packit#622)
  • node-engine
    • Build arm version of buildpack
    • Add arm dependencies
  • yarn
    • Build arm version of buildpack
    • Add arm dependencies
  • yarn-install
    • Build arm version of buildpack
  • npm-install
    • Build arm version of buildpack
  • yarn-start
    • Build arm version of buildpack
  • npm-start
    • Build arm version of buildpack
  • node-start
    • Build arm version of buildpack
  • nodejs metabuildpack on arm

Motivation

Support arm.

@DZ0011111
Copy link

DZ0011111 commented Jan 16, 2025

i`m using below command to run pack build :

**pack build $CONTAINER_REGISTRY/planning-collaboration-ui:latest-$VER --path ./app/planning --buildpack gcr.io/paketo-buildpacks/nodejs \ --builder paketobuildpacks/builder:base**

it will get below error:
ERROR: failed to build: downloading buildpack: extracting from registry gcr.io/paketo-buildpacks/nodejs: fetching image: image with reference **gcr.io/paketo-buildpacks/nodejs:latest was found but its platform (linux) does not match the specified platform (linux/amd64)**

using :
Darwin KWHY6HVW1C 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:02:41 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6030 arm64

Docker version 27.4.1

@c0d1ngm0nk3y
Copy link
Author

@DZ0011111 This is caused by buildpacks/pack#2315 - pack stopped working in that case because docker changed an error message :( You have a couple of workarounds here...

  • You could downgrade the docker daemon again, so that the error message is again what pack understands
  • You can modify the manifest locally and add the architecture - nodejs has no architecture yet, which triggers the problem
  • (recommended) You can omit the --buildpack and rely on the auto detection for now. The problem is only triggered if a buildpack without architecture is downlaoded
  • You specify the buildpack by id (--buildpack paketo-buildpacks/nodejs) - this will use the buildpack from the builder and not download it

But since this issue is already fixed on pack, it should only be a matter of days until a new version of pack is available and this issue is gone. I hope that helps for the meantime.

@mhdawson fyi - in case you face similar issues

@pacostas
Copy link
Contributor

I dont think building an arm image is supported yet by nodejs buildpack. You are also using the bionic builder which is deprecated, you can use jammy instead. Also you only need the builder as nodejs is already included in the builder.

pack build $CONTAINER_REGISTRY/planning-collaboration-ui:latest-$VER --path ./app/planning --builder paketobuildpacks/builder-jammy-base

@c0d1ngm0nk3y
Copy link
Author

I don't think this is about arm since amd dockerfiles will also work on mac. That worked perfectly fine until an update of docker. Then pack would try the default image if there is no arm one. But this fallback broke.

@DZ0011111 Could you verify if the workaround works for you?

@DZ0011111
Copy link

DZ0011111 commented Jan 17, 2025

I don't think this is about arm since amd dockerfiles will also work on mac. That worked perfectly fine until an update of docker. Then pack would try the default image if there is no arm one. But this fallback broke.

@DZ0011111 Could you verify if the workaround works for you?

Hi @c0d1ngm0nk3y @pacostas yeah, i`m using:

pack build $CONTAINER_REGISTRY/planning-collaboration-ui:latest-$VER --path ./app/planning \ --buildpack paketo-buildpacks/nodejs \ --builder paketobuildpacks/builder-jammy-base

now it works fine for me, thanks for your reply

ENV:
Docker version 27.4.1, build b9d17eaebb
MacOS arm64
Docker desktop v4.37.2

@pacostas
Copy link
Contributor

I see, I thought the default export image would be an arm one, once he uses darwin, but I guess that's not the case unless the user specifies it through target flag. @DZ0011111 You can remove the --buildpack paketo-buildpacks/nodejs, the buildpack is already inside the builder

@DZ0011111
Copy link

DZ0011111 commented Jan 17, 2025

I see, I thought the default export image would be an arm one, once he uses darwin, but I guess that's not the case unless the user specifies it through target flag. @DZ0011111 You can remove the --buildpack paketo-buildpacks/nodejs, the buildpack is already inside the builder

Hi @pacostas it works after remove --buildpack paketo-buildpacks/nodejs .
and i also remove --buildpack urn:cnb:builder:paketo-buildpacks/java in java project, it also works fine. so my new code is:

for java:
pack build $CONTAINER_REGISTRY/planning-collaboration-srv:latest-$VER --path planning-uiservice/target/*-exec.jar \ --builder paketobuildpacks/builder-jammy-base \ --env BP_JVM_VERSION=17

for nodejs:
pack build $CONTAINER_REGISTRY/planning-collaboration-ui:latest-$VER --path ./app/planning \ --builder paketobuildpacks/builder-jammy-base

thank you all for your help😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants