Skip to content

Commit

Permalink
docker release script updated
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Feb 25, 2020
1 parent e43c06a commit 5ebc458
Show file tree
Hide file tree
Showing 2 changed files with 287 additions and 300 deletions.
46 changes: 16 additions & 30 deletions docker-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,31 @@ dbtags=( mysql mongodb rethinkdb )
# Read dockerhub login/password from a separate file
source .dockerhub

# Obtain dockerhub API auth token
jstoken=`curl -X POST \
-H "Content-Type: application/json" \
-d "{\"username\":\"${user}\",\"password\":\"${pass}\"}" \
https://hub.docker.com/v2/users/login/ \
| python -c "import json,sys;obj=json.load(sys.stdin);print obj['token'];"`
# Login to docker hub
docker login -u $user -p $pass

# Remove earlier builds
for dbtag in "${dbtags[@]}"
do
if [ -n "$FULLRELEASE" ]; then
curl -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT ${jstoken}" \
https://hub.docker.com/v2/repositories/tinode/tinode-${dbtag}/tags/latest/
curl -u $user:$pass -i -X DELETE \
https://cloud.docker.com/v2/repositories/tinode/tinode-${dbtag}/tags/latest/

curl -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT ${jstoken}" \
https://hub.docker.com/v2/repositories/tinode/tinode-${dbtag}/tags/${ver[0]}.${ver[1]}/
curl -u $user:$pass -i -X DELETE \
https://cloud.docker.com/v2/repositories/tinode/tinode-${dbtag}/tags/${ver[0]}.${ver[1]}/
fi
curl -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT ${jstoken}" \
https://hub.docker.com/v2/repositories/tinode/tinode-${dbtag}/tags/${ver[0]}.${ver[1]}.${ver[2]}/
curl -u $user:$pass -i -X DELETE \
https://cloud.docker.com/v2/repositories/tinode/tinode-${dbtag}/tags/${ver[0]}.${ver[1]}.${ver[2]}/
done

if [ -n "$FULLRELEASE" ]; then
curl -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT ${jstoken}" \
https://hub.docker.com/v2/repositories/tinode/chatbot/tags/latest/
curl -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT ${jstoken}" \
https://hub.docker.com/v2/repositories/tinode/chatbot/tags/${ver[0]}.${ver[1]}/
curl -u $user:$pass -i -X DELETE \
https://cloud.docker.com/v2/repositories/tinode/chatbot/tags/latest/
curl -u $user:$pass -i -X DELETE \
https://cloud.docker.com/v2/repositories/tinode/chatbot/tags/${ver[0]}.${ver[1]}/
fi
curl -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT ${jstoken}" \
https://hub.docker.com/v2/repositories/tinode/chatbot/tags/${ver[0]}.${ver[1]}.${ver[2]}/
curl -u $user:$pass -i -X DELETE \
https://cloud.docker.com/v2/repositories/tinode/chatbot/tags/${ver[0]}.${ver[1]}.${ver[2]}/

# Deploy images for various DB backends
for dbtag in "${dbtags[@]}"
Expand All @@ -84,3 +68,5 @@ if [ -n "$FULLRELEASE" ]; then
docker push tinode/chatbot:"${ver[0]}.${ver[1]}"
fi
docker push tinode/chatbot:"${ver[0]}.${ver[1]}.${ver[2]}"

docker logout
Loading

0 comments on commit 5ebc458

Please sign in to comment.