Skip to content

showcase spring boot cloud native app built using jib on google cloud run

Notifications You must be signed in to change notification settings

shavo007/spring-boot-jib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-boot-jib

Jibbing with spring boot

Buildpacks

Install docker and download the pack tool

Buildpacks inspect your source and try to identify it as something it knows how to build.

pack build --builder=gcr.io/buildpacks/builder:v1 spring-boot-web:buildpacks

docker run --rm -it -ePORT=8080 -p8080:8080 spring-boot-web:buildpacks

Pros

  • Buildpacks are nice because in many cases they just work and you don't have to do anything special to turn your source into something runnable.
  • Auto detection - Detection criteria is specific to each buildpack – for instance, an NPM buildpack might look for a package.json, and a Go buildpack might look for Go source files.

Cons

  • image is quite bulky
  • all of the dependencies and compiled application code are stored in a single layer

Jib

Build with local docker daemon

./gradlew jibDockerBuild
docker run --rm -it -ePORT=8080 -p8080:8080 spring-boot-web:jib

Pros

  • Unlike buildpack, original src code is not included
  • dont even need docker if you store the image in a container registry such as docker hub or google cloud container registry
  • base image is distroless so no package managers or shells
  • Gradle Jib extensions for Spring Boot, which provide a convenient way to address the long-standing “spring-boot-devtools” issue. (dep not included in the image)
  • makes use of layering for fast rebuilds (as seen in dive inspect)
  • dont have to worry about constructing a docker file (not that its too hard..)
  • great option with Maven and Gradle builds for Container Images that use the JVM.

Cons

  • Only for jvm languages

docker

docker build -t spring-boot-web:dockerfile .
docker run --rm -it -ePORT=8080 -p8080:8080 spring-boot-web:dockerfile

Pros

  • can use multi phase approach
  • language agnostic
  • great power comes great responsibility!

Cons

  • potentially a lack of consistency across our docker files
  • not using correct layering or lightweight base images

redoc cloud run deployment

gcloud run deploy redoc-greetings-api --project $PROJECT_ID --image gcr.io/$PROJECT_ID/redoc --platform managed --region us-central1 --port 80 --cpu 1 --memory 256Mi --concurrency 80 --timeout 300 --update-env-vars SPEC_URL=https://<CLOUD_RUN_SPRING_BOOT_BASE_URI>/swagger.yaml

Resources

About

showcase spring boot cloud native app built using jib on google cloud run

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages