How it works...

In the preceding example, we saw how easy it is to have our build package the application in a Docker container. The additional Gradle-Docker plugin does the bulk of the work of the Dockerfile creation, image building, and publishing; all we have to do is give it some instructions on what and how we want the image to be. Because the Spring Boot Gradle plugin uses a boot distribution, the Gradle-Docker plugin does not know that it needs to use a bootified TAR archive. To help with that, we override the distDocker task. Let's examine these instructions in detail:

  • The group and description attributes merely help with displaying the task properly when the ./gradlew tasks command is executed.
  • The inputs.files project.bootDistTar ...

Get Developing Java Applications with Spring and Spring Boot now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.