Is it possible to build GraalVM Native binary on Apple's M1/2 Architecture and run on arm64? (ubuntu machine)

106 Views Asked by At

I am running Quarkus Application on Heroku. Based on this tutorial. I build native binary and put it inside docker, and this docker image runs inside heroku. In the past I used Mac with Intel, so was able to build and push the image to heroku. Now I switched to Mac with M2 Processor. Is it still possible to build the image on mac and run it on heroku? Apple Silicon Valley is linux/arm64/v8 and Heroku probably needs arm64. How can I do this?

In the documentation: https://www.graalvm.org/22.0/reference-manual/native-image/Options/

I see this option: --target: select the native image compilation target (in - format). It defaults to the host's OS-architecture pair.

Edited: current size of native(runner) files:

  • Intel - 88M
  • Apple M2- 86M

Eited v2:

I decided to use github action, and build it there, action file:

name: Build artifacts

on:
  push:
    tags:
      - '[0-9].[0-9].[0-9]'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: graalvm/setup-graalvm@v1
        with:
          java-version: '17'
          distribution: 'graalvm'
      - name: Building native, executable binary   # https://graalvm.github.io/native-build-tools/latest/maven-plugin.html
        run: mvn package -Pnative -Dquarkus.native.container-build=true

But now I am looking for the solution, how/where can I publish this binary file, so later can I use it. Any ideas?

0

There are 0 best solutions below