Instead of using uname -m or other similar commands to perform platform detection, use the appropriate CNB_TARGET_* environment variables.
Reference: https://github.com/buildpacks/spec/blob/main/buildpack.md#environment
Also, note that using uname during builds breaks cross-platform builds (running builder image is not the same platform as the target image).