DEV Community


Posted on

Micronaut PetClinic with GraalVM > 19

Now you can run Micronaut PetClinic with the (kinda) latest GraalVM Native Image. I will explain the meaning later.

Build & Run

$ git clone
$ cd micronaut-petclinic

# Build Native Image. Please wait for 10-15 minutes.
$ ./mvnw package && docker build -t micronaut-petclinic .

# Start Database
$ docker-compose up -d db

# Run separately to see the log easily
$ docker-compose up app
Enter fullscreen mode Exit fullscreen mode

Start up time

It starts in a few hundreds of millis.

Docker Information

The image size is 130MB.

❯ docker images micronaut-petclinic
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
micronaut-petclinic   latest              40834e227e19        About an hour ago   130MB
Enter fullscreen mode Exit fullscreen mode

and the memory usage is 125MB after using for a while

❯ docker ps -f name=micronaut-petclinic_app* -q | xargs docker stats --no-stream
CONTAINER ID        NAME                                     CPU %               MEM USAGE / LIMIT    MEM %               NET I/O             BLOCK I/O           PIDS
5c4c627ee81d        micronaut-petclinic_app_1_1350df269f2b   0.07%               124.3MiB / 15.4GiB   0.79%               158kB / 121kB       0B / 0B             11

Enter fullscreen mode Exit fullscreen mode


I created Micronaut PetClinic last month and it worked as Native Image with GraalVM 1.0 RC16 to start surprisingly fast speed in a few hundreds of millis.

A few days later, GraalVM released a production version 19.0.0.

But unfortunately, my PetClinic doesn't work with GraalVM 19 Native Image. (´・ω・`)

The cause is this issue:

and we need this commit:

The commit hasn't been included in the latest version 19.0.2 released yesterday.

Docker Image with the latest GraalVM

Then I found it works when I build GraalVM from its master branch. So I created a Docker image with the master branch:

I would like to use it for a while until the commit is included in the GraalVM official release.

With Micronaut, it's so easy to create an application for Native Image, but I would like to talk about it another time (๑•̀ㅂ•́)و✧

Top comments (0)