diff --git a/rebuild-docker.sh b/rebuild-docker.sh index 0e447b3..7085e6e 100755 --- a/rebuild-docker.sh +++ b/rebuild-docker.sh @@ -63,6 +63,12 @@ git stash 1>&2 git pull --rebase 1>&2 popd 1>&2 +function docker_tag_exists() { + . /srv/repository/docker-credentials + TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token) + curl --silent -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null +} + # Docker Metaimage function do_docker_meta() { pushd ${metapackages_dir} 1>&2 @@ -76,9 +82,13 @@ do_docker_meta() { server_ok="" web_ok="" for arch in ${docker_arches[@]}; do - curl --silent -f -lSL https://index.docker.io/v1/repositories/jellyfin/jellyfin-server/tags/${version}-${arch} >/dev/null && server_ok="${server_ok}y" + if docker_tag_exists jellyfin/jellyfin-server ${version}-${arch}; then + server_ok="${server_ok}y" + fi done - curl --silent -f -lSL https://index.docker.io/v1/repositories/jellyfin/jellyfin-web/tags/${version} >/dev/null && web_ok="y" + if docker_tag_exists jellyfin/jellyfin-web ${version}; then + web_ok="y" + fi if [[ ${server_ok} != "yyy" || ${web_ok} != "y" ]]; then return fi