This is an example of dockerized GraalVM native image build. Produced image is inherited from scratch, thus a few MB in size.
Project includes a Spark server with of couple of web resources:
- GET /exception - logs an exception
- GET /ping - returns "hi" message
- GET /person/1 - returns a simple dto
- POST /person - logs provided dto
Example:
curl --header --request POST --data {"name":"Joe"} http://localhost:8080/person
If you are on windows, execute:
run.cmd
Docker image/container names: graalvm-native
Image size is under 20Mb.
docker stats
MEM USAGE/LIMIT: 1.605MiB / 4MiB
- http://openjdk.java.net/jeps/295
- https://stackoverflow.com/questions/46579565/is-ahead-of-time-compilation-available-in-java-9