#!/bin/bash set -x HUB=${3:-astroconda} PROJECT=${HUB}/base PROJECT_VERSION="${1}" TAGS=() if [[ -z ${PROJECT_VERSION} ]]; then echo "Project version required [e.g. 1.2.3... \$(git describe)]" exit 1 fi read \ PROJECT_VERSION_MAJOR \ PROJECT_VERSION_MINOR \ PROJECT_VERSION_PATCH <<< ${PROJECT_VERSION//\./ } case "${HUB}" in *amazonaws\.com) if ! type -p aws; then echo "awscli client not installed" exit 1 fi REGION="$(awk -F'.' '{print $(NF-2)}' <<< ${HUB})" $(aws ecr get-login --no-include-email --region ${REGION}) unset REGION ;; *) # Assume default index docker login ;; esac TAGS+=( "-t ${PROJECT}:${PROJECT_VERSION}" ) is_tag_latest=$([[ -f LATEST ]] && [[ $(