Skip to content

Commit

Permalink
Add support for native-image images, revert to use entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kgston committed Jul 31, 2023
1 parent ebcdb21 commit 4e45cc0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
graalVMNativeImageGraalVersion.value match {
case Some(splitPackageVersion(packageName, tag)) =>
packageName match {
case "graalvm-community" => Def.task(Some(s"$GraalVMBaseImagePath$packageName:$tag"): Option[String])
case _ =>
case "native-image-community" | "native-image" =>
Def.task(Some(s"$GraalVMBaseImagePath$packageName:$tag"): Option[String])
case "graalvm-community" | "graalvm-ce" =>
generateContainerBuildImage(
s"${GraalVMBaseImagePath}graalvm-ce:$tag",
s"${GraalVMBaseImagePath}$packageName:$tag",
graalVMNativeImagePlatformArch.value
)
case _ => sys.error("Other ghcr.io/graalvm images are unsupported")
}
case Some(tag) =>
generateContainerBuildImage(s"${GraalVMBaseImagePath}graalvm-ce:$tag", graalVMNativeImagePlatformArch.value)
Expand Down Expand Up @@ -170,7 +172,6 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
"-v",
s"${targetDirectory.getAbsolutePath}:$graalDestDir",
image,
"native-image",
"-cp",
(resourcesDestDir +: classpathJars.map(jar => s"$stageDestDir/" + jar._2)).mkString(":"),
s"-H:Name=$binaryName"
Expand Down Expand Up @@ -228,7 +229,7 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
Cmd("WORKDIR", "/opt/graalvm"),
ExecCmd("RUN", "gu", "install", "native-image"),
ExecCmd("RUN", "sh", "-c", "ln -s /opt/graalvm-ce-*/bin/native-image /usr/local/bin/native-image"),
ExecCmd("CMD", "native-image")
ExecCmd("ENTRYPOINT", "native-image")
).makeContent

val command = dockerCommand ++ Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ enablePlugins(GraalVMNativeImagePlugin)
name := "docker-test"
version := "0.1.0"
graalVMNativeImageOptions := Seq("--no-fallback")
graalVMNativeImageGraalVersion := Some("graalvm-community:17.0.8")
graalVMNativeImageGraalVersion := Some("native-image-community:17.0.8")
graalVMNativeImagePlatformArch := Some("arm64")
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ enablePlugins(GraalVMNativeImagePlugin)
name := "docker-test"
version := "0.1.0"
graalVMNativeImageOptions := Seq("--no-fallback")
graalVMNativeImageGraalVersion := Some("graalvm-ce:22.3.3")
graalVMNativeImageGraalVersion := Some("native-image:22.3.3")

0 comments on commit 4e45cc0

Please sign in to comment.