tostao
tostao

Reputation: 3048

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

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:

Edited v2:

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

name: Heroku-Bot-CI Build artifacts for new tag

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

jobs:
  build_and_upload:
    name: Set up JDK 21
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: graalvm/setup-graalvm@v1
      with:
        java-version: 21
        distribution: 'graalvm'
    - run: mvn package -Pnative -Dquarkus.native.container-build=true

    - uses: actions/upload-artifact@v4
      with:
        name: heroku-bot-runner-${{github.ref_name}}
        path: target/heroku-bot-1.0-SNAPSHOT-runner
        if-no-files-found: error

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

Upvotes: 2

Views: 431

Answers (0)

Related Questions