How to generate multiple docker image from one build.gradle

Hello Everyone,

I am working multi module springboot project, which is using Gradle to build, geneateImage and so on.
Following is the sample project structure we have, to generate the image I execute bootBuildImage plugin and it works fine. System generates three different images, each for one module.

Root
  SubModule1
     build.gradle
  SubModule2
    build.gradle
  SubModule3
    build.gradle
build.gradle

Now, I have requirement, Submodule1 need to generate two different images from same source code but need to copy different resource to build images.
Can someone help me, how I can generate two different images in submodule1 using same source code.

You probably need to register a second task of that type, configured according to your needs.
I’d recommend you look in the docs of the plugin that you use for that or if they are not clear enough ask its maintainer how to achieve it.

I am using springboot com.bmuschko.docker-remote-api plugin for this. Not sure, how to register second task to generate second image. My understanding is this plugin generate images per build.gradle basis.

Not sure, how to register second task to generate second image.

Using tasks.register or tasks.registering.

My understanding is this plugin generate images per build.gradle basis.

That might be, but nothing prevents you from registering additional tasks that are configured differently, except if the plugin is coded badly, but I don’t expect that from bmuschko.