Skip to content

Build containerized spring boot application with jib.

Notifications You must be signed in to change notification settings

ptorre/spring-boot-jib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

build Publish release to container registry

spring-boot-jib

Simple template for building a Spring Boot Demo application into a container image using the Jib maven plugin.

Usage

The Jib maven plugin can be used to create a container image:

  • The jib plugin can build a tar archive of the image using the jib:buildTar goal. This can be loaded into a minikube cluster with minikube image load <image.tar> etc..

    The jib:dockerBuild goal can build the image directly to a docker daemon running running in a minikube cluster, if the required environment variables are set correctly. The output from minikube docker-env can be used to set the correct environment variables.

    (This should also work with either a local docker daemon, but I have not tested this.)


Examples:

  • mvn clean compile jib:buildTar, creates a tar archive that can be loaded to the internal minikube cluster repo with the command: minikube image load <image.tar>)

  • Use other mvn build profiles to build from a different image base or with different options (See 'pom.xml'):

    mvn clean compile jib:buildTar -P distroless default

    mvn clean compile jib:buildTar -P amazoncorretto

    mvn clean compile jib:buildTar -P amazonlambda

  • Deploy image after build into docker (requires running local docker instance or other configuration.):

    mvn clean compile jib:dockerBuild


Reference Documentation

See the reference documentation for more detailed information:

Basic demo Spring Boot Demo application generated by spring initializer at start.spring.io.