Hey everyone ,
I’m facing the following issue: I want to create a Native-Image of a Hilla app using GraalVM. I want to create the Native-Image in separate Build-Stage in a Dockerfile. This is the Dockerfile:
# First stage: Base image with GraalVM and native image support
FROM ghcr.io/graalvm/native-image-community:21.0.2 AS build
WORKDIR /usr/src/app
# Copy project files
COPY . .
# Create native image
RUN ./mvnw clean package -Pproduction -Pnative native:compile
# Second stage: Lightweight base image
FROM debian:bookworm-slim
WORKDIR /app
# Copy the native image from the build stage
COPY --from=build /usr/src/app/target/hilla-example-app /app/hilla-example-app
EXPOSE 8080
CMD ["/app/hilla-example-app"]
Next, I try to build a Docker-Image based on this Dockerfile:
docker|podman build --tag hilla-example-app:native .
During the execution of vaadin-maven-plugin:24.5.0:build-frontend (default) @ hilla-example-app
I see the following error:
[INFO] --- vaadin-maven-plugin:24.5.0:build-frontend (default) @ hilla-example-app ---
[INFO] Reflections took 994 ms to scan 153 urls, producing 5643 keys and 32444 values
[INFO] Scanning classes to find frontend configurations and dependencies...
[INFO] Visited 5388 classes. Took 4832 ms.
[INFO] Checking if a production mode bundle build is needed
[INFO] Frontend build requested.
[INFO] Running `npm install` to resolve and optionally download frontend dependencies. This may take a moment, please stand by...
[INFO] using '/root/.vaadin/node/node /root/.vaadin/node/lib/node_modules/npm/bin/npm-cli.js --no-update-notifier --no-audit --scripts-prepend-node-path=true --ignore-scripts install' for frontend package installation
[INFO] Frontend dependencies resolved successfully.
[ERROR] Failed to run TypeScript endpoint generator
com.vaadin.hilla.engine.GeneratorException: Node execution failed
at com.vaadin.hilla.engine.GeneratorProcessor.process (GeneratorProcessor.java:62)
at com.vaadin.hilla.internal.TaskGenerateEndpointImpl.execute (TaskGenerateEndpointImpl.java:82)
at com.vaadin.flow.server.frontend.NodeTasks.execute (NodeTasks.java:344)
at com.vaadin.flow.plugin.base.BuildFrontendUtil.runNodeUpdater (BuildFrontendUtil.java:343)
at com.vaadin.flow.plugin.maven.BuildFrontendMojo.execute (BuildFrontendMojo.java:142)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke (Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke (Method.java:580)
at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:47)
at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:156)
at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:72)
Caused by: com.vaadin.hilla.engine.commandrunner.CommandRunnerException: Command failed with exit code 139: /root/.vaadin/node/node
at com.vaadin.hilla.engine.commandrunner.CommandRunner.executeCommand (CommandRunner.java:167)
at com.vaadin.hilla.engine.commandrunner.CommandRunner.run (CommandRunner.java:98)
at com.vaadin.hilla.engine.commandrunner.CommandRunner.run (CommandRunner.java:73)
at com.vaadin.hilla.engine.GeneratorProcessor.process (GeneratorProcessor.java:50)
at com.vaadin.hilla.internal.TaskGenerateEndpointImpl.execute (TaskGenerateEndpointImpl.java:82)
at com.vaadin.flow.server.frontend.NodeTasks.execute (NodeTasks.java:344)
at com.vaadin.flow.plugin.base.BuildFrontendUtil.runNodeUpdater (BuildFrontendUtil.java:343)
at com.vaadin.flow.plugin.maven.BuildFrontendMojo.execute (BuildFrontendMojo.java:142)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke (Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke (Method.java:580)
at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:47)
at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:156)
at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:72)
Has anyone any ideas what could cause the problem?