Skip to content

Commit 947439b

Browse files
committed
Fix buildx docker image not found
1 parent bb0faad commit 947439b

File tree

1 file changed

+25
-33
lines changed

1 file changed

+25
-33
lines changed

src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,13 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
110110
}
111111
)
112112

113-
private def buildLocal(
114-
targetDirectory: File,
115-
binaryName: String,
116-
nativeImageCommand: String,
117-
className: String,
118-
classpathJars: Seq[File],
119-
extraOptions: Seq[String],
120-
log: ProcessLogger
121-
): File = {
113+
private def buildLocal(targetDirectory: File,
114+
binaryName: String,
115+
nativeImageCommand: String,
116+
className: String,
117+
classpathJars: Seq[File],
118+
extraOptions: Seq[String],
119+
log: ProcessLogger): File = {
122120
targetDirectory.mkdirs()
123121
val command = {
124122
val nativeImageArguments = {
@@ -128,8 +126,7 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
128126
IO.withTemporaryFile("native-image-classpath", ".txt", keepFile = true) { file =>
129127
IO.write(file, s"--class-path $classpath")
130128
Seq(s"@${file.absolutePath}")
131-
}
132-
else Seq("--class-path", classpath)
129+
} else Seq("--class-path", classpath)
133130
cpArgs ++ Seq(s"-H:Name=$binaryName") ++ extraOptions ++ Seq(className)
134131
}
135132
Seq(nativeImageCommand) ++ nativeImageArguments
@@ -141,18 +138,16 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
141138
}
142139
}
143140

144-
private def buildInDockerContainer(
145-
targetDirectory: File,
146-
binaryName: String,
147-
className: String,
148-
classpathJars: Seq[(File, String)],
149-
extraOptions: Seq[String],
150-
platformArch: Option[String],
151-
dockerCommand: Seq[String],
152-
resources: Seq[(File, String)],
153-
image: String,
154-
streams: TaskStreams
155-
): File = {
141+
private def buildInDockerContainer(targetDirectory: File,
142+
binaryName: String,
143+
className: String,
144+
classpathJars: Seq[(File, String)],
145+
extraOptions: Seq[String],
146+
platformArch: Option[String],
147+
dockerCommand: Seq[String],
148+
resources: Seq[(File, String)],
149+
image: String,
150+
streams: TaskStreams): File = {
156151
import sys.process._
157152
stage(targetDirectory, classpathJars, resources, streams)
158153

@@ -193,10 +188,8 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
193188
*
194189
* The passed in docker image must have GraalVM installed and on the PATH, including the gu utility.
195190
*/
196-
def generateContainerBuildImage(
197-
baseImage: String,
198-
platformArch: Option[String] = None
199-
): Def.Initialize[Task[Option[String]]] =
191+
def generateContainerBuildImage(baseImage: String,
192+
platformArch: Option[String] = None): Def.Initialize[Task[Option[String]]] =
200193
Def.task {
201194
import sys.process._
202195

@@ -238,6 +231,7 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
238231
"build",
239232
"--platform",
240233
platformValue,
234+
"--load",
241235
"--label",
242236
s"com.typesafe.sbt.packager.graalvmnativeimage.platform=$platformValue",
243237
"-t",
@@ -258,12 +252,10 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
258252
Some(imageName)
259253
}
260254

261-
private def stage(
262-
targetDirectory: File,
263-
classpathJars: Seq[(File, String)],
264-
resources: Seq[(File, String)],
265-
streams: TaskStreams
266-
): File = {
255+
private def stage(targetDirectory: File,
256+
classpathJars: Seq[(File, String)],
257+
resources: Seq[(File, String)],
258+
streams: TaskStreams): File = {
267259
val stageDir = targetDirectory / "stage"
268260
val mappings = classpathJars ++ resources.map {
269261
case (resource, path) => resource -> s"resources/$path"

0 commit comments

Comments
 (0)