gradle-docker icon indicating copy to clipboard operation
gradle-docker copied to clipboard

Generate two images?

Open pluttrell opened this issue 8 years ago • 3 comments

Is there a way to generate multiple Docker images from the same Gradle script? For example if we wanted to generate separate Docker images from separate Dockerfiles? I know this can be done with a multi-module project, but I have one case where that’s not a good solution.

pluttrell avatar Oct 22 '17 10:10 pluttrell

This plugin does not enable that functionality -- practically speaking we probably ought to move in the direction of making this more like the built-in publishing plugins, where one can declare multiple output artifacts, but that'd be a fairly significant change and we're fond of the simplicity/ease of understanding of one project -> one docker image.

Given that, the only way to get multiple images with this plugin is to have multiple projects -- but you can use the project declaration syntax in Gradle to get subprojects without also needing directories (however, the projects must still be listed in your settings.gradle file).

markelliot avatar Oct 22 '17 11:10 markelliot

@markelliot Many thanks for getting back to me and for the suggestion to create a subproject without the actual directories.

Regarding moving to a publishing style vs the current simplistic approach. Perhaps both is the answer. Maybe com.plantir.docker-publish for one that works that way.

pluttrell avatar Oct 23 '17 18:10 pluttrell

Still no way to generate 2 images without manually modifying the docker block each and every time? If not what's the work around, do I need a build.gradle file for every Docker staging file segregated? The Dockerfile is for generating the image and the compose file is for deploying and spinning it up correct?

winthrop-polk avatar Jul 06 '20 07:07 winthrop-polk