How can I set another tag for docker build step in the Jenkins pipeline which uses docker.build() script?
As for now I have:
docker.build("artifactory/docker/${IMAGE_NAME}:${BUILD_NO}")
and then
rtDockerPush(
serverId: "Artifactory",
image: "artifactory/docker/${IMAGE_NAME}:${BUILD_NO}",
targetRepo: 'docker',
)
rtPublishBuildInfo(
serverId: "Artifactory"
)
but I want to tag it with the :latest as well
I have tried something like:
docker.build("artifactory/docker/${IMAGE_NAME}:${BUILD_NO}","-t latest .")
but that is not working (it got published only with build number).
Any tips on that?
PS. Based on the given answer I have ended up to have two calls for the push as follow:
rtDockerPush(
serverId: "Artifactory",
image: "artifactory/docker/${IMAGE_NAME}:${BUILD_NO}",
targetRepo: 'docker',
)
rtDockerPush(
serverId: "Artifactory",
image: "artifactory/docker/${IMAGE_NAME}:latest",
targetRepo: 'docker',
)
rtPublishBuildInfo(
serverId: "Artifactory"
)