Skip to content

java-online-training/spring-boot-3-native-images

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Native Docker Images with Spring Boot 3

To run this demo, you need to have Docker, Maven and GraalVM for Java version 17 or later installed on your machine.

Clone the repo to your local machine:

git clone https://github.com/java-online-training/spring-boot-3-native-images

Next, navigate into the project.

How to build a native application as a Docker image

To Build a native Docker image with Maven simply execute:

mvn -Pnative spring-boot:build-image

To start the image with Docker after the build:

docker run --rm -p 8080:8080 docker.io/library/native-image-demo:0.0.1-SNAPSHOT

To access the endpoint hit the following URL in your browser:

http://localhost:8080/books

How to build a Native Executable without Docker

If you are using Linux on your development machine, you can build the native application also locally without Docker:

mvn -Pnative native:compile

This generates the executable binary native-image-demo in the target directoy. To start the executable simply execute:

./target/native-image-demo

Check out this blog post for more infos about Spring native images: https://java-online-training.de/?p=61

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages