Simple Project

Illustrate how to build a simple App and deploy to K8s without too much effort. Tools used:

Getting Started

  • Build Code
mvn clean package -Ddekorate.build=true
  • Build Docker image
docker build -t matthewgardner/demo:0.0.1-SNAPSHOT .
  • Deploy to K8s
tilt up

Guides

The following guides illustrate how to use some features concretely:

Spring Native

This project has been configured to let you generate either a lightweight container or a native executable.

Lightweight Container with Cloud Native Buildpacks

If you're already familiar with Spring Boot container images support, this is the easiest way to get started with Spring Native. Docker should be installed and configured on your machine prior to creating the image, see the Getting Started section of the reference guide.

To create the image, run the following goal:

$ ./mvnw spring-boot:build-image

Then, you can run the app like any other container:

$ docker run --rm -p 8080:8080 demo:0.0.1-SNAPSHOT

Executable with Native Build Tools

Use this option if you want to explore more options such as running your tests in a native image. The GraalVM native-image compiler should be installed and configured on your machine, see the Getting Started section of the reference guide.

To create the executable, run the following goal:

$ ./mvnw package -Pnative

Then, you can run the app as follows:

$ target/demo