Skip to content

Commit

Permalink
Tag the newly built docker as remote latest and push to the remote re…
Browse files Browse the repository at this point in the history
…gistry

Signed-off-by: Wenda <[email protected]>
  • Loading branch information
wendani committed May 25, 2018
1 parent d165a50 commit 3ed7ed5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions push_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$DOCKER_IMA
timestamp="$(date -u +%Y%m%d)"
build_version="${timestamp}.bld-${BUILD_NUMBER}"
build_remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$build_version
remote_image_name_latest=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:latest

## Add registry information as tag, so will push as latest
## Add additional tag with build information
docker tag $docker_image_name $remote_image_name
docker tag $docker_image_name $build_remote_image_name
docker tag $docker_image_name $remote_image_name_latest

## Login the docker image registry server
## Note: user name and password are passed from command line
Expand All @@ -39,4 +41,6 @@ echo "Image sha256: $image_sha"
echo "Pushing $build_remote_image_name"
docker push $build_remote_image_name
docker rmi $build_remote_image_name || true
docker push $remote_image_name_latest
docker rmi $remote_image_name_latest || true
docker rmi $docker_image_name || true

0 comments on commit 3ed7ed5

Please sign in to comment.