use repo2docker version in docker tags
docker tags will include versioneer tag, e.g. `0.10.0-4.abc123` where
0.10.0 is the latest tag
4 is the number of commits since then
abc123 is the current commit hash
#!/bin/bash
-# when building jupyter/repo2docker:master also push jupyter/repo2docker:abcd1234
-
-HASH_IMAGE="$DOCKER_REPO:${SOURCE_COMMIT:0:8}"
-docker tag $DOCKER_REPO:$DOCKER_TAG $HASH_IMAGE
-docker push $HASH_IMAGE
+# when building jupyter/repo2docker:master
+# also push jupyter/repo2docker:1.2.3-3.abcd1234 (replace + with -)
+version=$(docker run $DOCKER_REPO:$DOCKER_TAG jupyter-repo2docker --version | sed s@+@-@)
+VERSION_IMAGE="$DOCKER_REPO:$version"
+docker tag $DOCKER_REPO:$DOCKER_TAG "$VERSION_IMAGE"
+docker push "$VERSION_IMAGE"
