The problem is that if you build the native-image using the sbt plugin, it will be a native image for your machine. That is, if you have macOS, it will run on macOS, and won’t run on linux; and vice versa.

More specifically, a native-image built on macOS (it’s native, after all :) ), won’t run in a docker container, which is a linux system. Moreover, not all linuxes are compatible with one another.

So if you want to build a native image in a platform-independent way, then yes, you need to build it in linux as well, which should match the linux you’re using for the run-time.

Scala software engineer, Functional Programming enthusiast, SoftwareMill co-founder

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store