micronaut-projects / micronaut-maven-plugin

Maven plugin to execute Micronaut applications
https://micronaut-projects.github.io/micronaut-maven-plugin/latest/
Apache License 2.0
20 stars 20 forks source link

Micronaut 4.5.0 docker native-image exits after showing banner #1158

Open hbxu opened 1 month ago

hbxu commented 1 month ago

Expected Behavior

$ curl localhost:8080/hello
Hello World

Actual Behaviour

JVM:

> java -jar .\demo-0.1.jar
 __  __ _                                  _   
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_ 
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|
15:00:42.231 [main] INFO  io.micronaut.runtime.Micronaut - Startup completed in 971ms. Server Running: http://localhost:8080

Docker with native image, exits? after showing Micronaut banner:

> docker run -p 8080:8080 demo
 __  __ _                                  _   
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_ 
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|

Steps To Reproduce

Building docker native-image:

> mvn clean package -Dpackaging=docker-native -Pgraalvm

Environment Information

Example Application

Version

Micronaut 4.5.0

alvarosanchez commented 1 month ago

I'm unable to reproduce it:

image

Might be a Windows issue. @houcine7 can you please try yourself?

hbxu commented 1 month ago

I don't have dnd.

I used

docker run -it --rm -v D:\micronaut-native-image-exits:/usr/src/myapp -w /usr/src/myapp maven:3.9.8-amazoncorretto-21 /bin/bash

and run, which will fail:

mvn clean package -Pgraalvm -Dpackaging=docker-native 

on my Windows machine, I completed the docker build:

docker build -t demo . --build-arg CLASS_NAME=com.example.Application --build-arg BASE_IMAGE=ghcr.io/graalvm/native-image-community:21-ol9 --build-arg BASE_IMAGE_RUN=cgr.dev/chainguard/wolfi-base:latest

It works

> docker run -p 8080:8080 demo
 __  __ _                                  _
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|
08:42:16.337 [main] INFO  io.micronaut.runtime.Micronaut - Startup completed in 25ms. Server Running: http://d86f592bbd11:8080
houcine7 commented 1 month ago

@alvarosanchez yes this is a windows issue and it is already reported [GCN-4274]

houcine7 commented 1 month ago

@alvarosanchez The pull request I raised for native arguments images fixed the this issue, because there was an issue related the way dependencies path is been parsed in case of windows.

alvarosanchez commented 1 month ago

Just to be clear, this is different to #1098 isn't it?

houcine7 commented 1 month ago

yes they are different