Skip to content

Instantly share code, notes, and snippets.

@adamw
Created May 17, 2019 13:11
Show Gist options
  • Save adamw/caa9bb0355ff809106031e937023ce32 to your computer and use it in GitHub Desktop.
Save adamw/caa9bb0355ff809106031e937023ce32 to your computer and use it in GitHub Desktop.
val runNativeImageCommand = Seq(
"docker",
"run",
"--rm",
"-v",
s"${cpDir.getAbsolutePath}:/opt/cp",
"-v",
s"${resultDir.getAbsolutePath}:/opt/graalvm",
"graalvm-native-image",
"-cp",
"/opt/cp/*",
"--static",
s"-H:Name=$resultName",
className
)
log.info("Running native-image using the 'graalvm-native-image' docker container")
log.info(s"Running: ${runNativeImageCommand.mkString(" ")}")
sys.process.Process(runNativeImageCommand, resultDir) ! streams.value.log match {
case 0 => resultDir / resultName
case r => sys.error(s"Failed to run docker, exit status: " + r)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment