palantir / gradle-docker

a Gradle plugin for orchestrating docker builds and pushes.
Apache License 2.0
746 stars 158 forks source link

Generate two images? #148

Open pluttrell opened 7 years ago

pluttrell commented 7 years ago

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.

markelliot commented 7 years ago

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).

pluttrell commented 7 years ago

@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.

winthrop-polk commented 4 years ago

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?