Transmode / gradle-docker

A Gradle plugin to build Docker images from the build script.
Apache License 2.0
647 stars 142 forks source link

Add multiple tags #50

Open JohanBas opened 9 years ago

JohanBas commented 9 years ago

I would like to tag my images with a version tag and latest tag.

mattgruter commented 9 years ago

Agreed! I'd like to fix this ASAP. The plugin should be able to double-tag the image.

ollehallin commented 9 years ago

I'd like to tag my image with any number of tags in addition to "${project.version}" and "latest", such as "${project.version}-${gitHash}".

Now I have to delegate the additional tagging to an external bash script, which is invoked by an Exec task which is invoked by distDocker.finalizedBy...

stevelaw commented 8 years ago

I agree, supporting multiple tags would be helpful.

kazemek commented 8 years ago

+1

leialexisjiang commented 8 years ago

Totally agree, we'd like to add alway latest and custom tag (project version)

My workaround is to use 2 docker tasks with different tag:

task deployTagDockerImage(type: Docker, dependsOn: build) {
    push = false
    applicationName = project.name
    tagVersion = project.version + '-' + gitCommitIdAbbrev
    registry = 'registry'
    dockerfile = file "${buildDir}/Dockerfile"
    stageDir = file "${buildDir}"
}

task deployDockerImage(type: Docker, dependsOn: deployTagDockerImage) {
    push = false
    applicationName = project.name
    tagVersion = 'latest'
    registry = 'registry'
    dockerfile = file "${buildDir}/Dockerfile"
    stageDir = file "${buildDir}"
}
leonardschneider commented 8 years ago

+1

My workaround:

distDocker << {
  def imageTag = "${-> project.group}/${-> applicationName}:"
  def tag = project.version
  exec {
    commandLine "docker", "tag", imageTag + tag, imageTag + "latest"
  }
}
jcfandino commented 7 years ago

Hi, I'd like to have this feature as well. I've sent you a pull request, can you check it out? Thanks.

jcfandino commented 7 years ago

Travis build failed because of this issue: https://github.com/travis-ci/travis-ci/issues/5227 I changed it to use openjdk8 and it works: https://travis-ci.org/jcfandino/gradle-docker

Is there a reason to use java7 in the build? Should I try to make it work with the old jdk or is it safe to upgrade jdk8?

orende commented 7 years ago

Any updates on this issue?

matthewjosephtaylor commented 7 years ago

This has been open a while, is there any movement on this? Really nice feature to have.