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

Add multiple tags

Open JohanBas opened this issue 9 years ago • 10 comments

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

JohanBas avatar Jun 12 '15 07:06 JohanBas

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

mattgruter avatar Jun 12 '15 07:06 mattgruter

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

ollehallin avatar Dec 02 '15 20:12 ollehallin

I agree, supporting multiple tags would be helpful.

stevelaw avatar Jan 04 '16 20:01 stevelaw

+1

kazemek avatar Jun 08 '16 11:06 kazemek

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}"
}

leialexisjiang avatar Jul 20 '16 08:07 leialexisjiang

+1

My workaround:

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

leonardschneider avatar Aug 03 '16 17:08 leonardschneider

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

jcfandino avatar Aug 17 '17 09:08 jcfandino

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?

jcfandino avatar Aug 17 '17 11:08 jcfandino

Any updates on this issue?

orende avatar Oct 16 '17 08:10 orende

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

matthewjosephtaylor avatar Oct 20 '17 23:10 matthewjosephtaylor