Skip to content

Files

Latest commit

c87a744 · Mar 12, 2025

History

History

spring-boot

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 24, 2020
Jan 7, 2020
Dec 5, 2019
Dec 5, 2019
Mar 12, 2025
Apr 3, 2019
Jan 7, 2020
Jan 7, 2020
Apr 3, 2019
Apr 3, 2019
Mar 12, 2025
Jan 7, 2020

README.md

Dockerize a Spring Boot application using Jib

This is an example of how to easily build a Docker image for a Spring Boot application with Jib.

Try it yourself

You can containerize the application with one of the following commands.

Maven:

./mvnw compile jib:build -Dimage=<your image, eg. gcr.io/my-project/spring-boot-jib>

Gradle:

./gradlew jib --image=<your image, eg. gcr.io/my-project/spring-boot-jib>

Deploying to Kubernetes using kubectl

Dockerize Spring Boot app with Jib and deploy to Kubernetes

Make sure you have kubectl installed and configured with a cluster.

IMAGE=<your image, eg. gcr.io/my-project/spring-boot-jib>

./mvnw compile jib:build -Dimage=$IMAGE

kubectl run spring-boot-jib --image=$IMAGE --port=8080 --restart=Never

# Wait until pod is running
kubectl port-forward spring-boot-jib 8080
curl localhost:8080
> Greetings from Spring Boot and Jib!

* If you are using Gradle, use ./gradlew jib --image=$IMAGE instead of the ./mvnw command

Give it a Tweet

More information

Learn more about Jib.

Build and run on Google Cloud

Run on Google Cloud