diff --git a/build.sh b/build.sh index 2ad8d74..12ae576 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,7 @@ ARCH=() VERSION_ARG=() VERSION="" REGISTRY="" +AZURITE_IMAGE="${AZURITE_IMAGE:-azurite:latest}" while [[ $# -gt 0 ]]; do case "$1" in @@ -33,18 +34,17 @@ while [[ $# -gt 0 ]]; do esac done -if [[ -z "$REGISTRY" ]]; then - IMAGE="azurite" -else - IMAGE="$REGISTRY/azurite" +if [[ ! -z "$REGISTRY" ]]; then + # Prepend the registry to the image name for tagging. + AZURITE_IMAGE="$REGISTRY/${AZURITE_IMAGE#*/}" fi if [[ -z "$VERSION" ]]; then - TAG_ARGS=("--tag" "$IMAGE:latest") + TAG_ARGS=("--tag" "${AZURITE_IMAGE%:*}:latest") elif [[ "$VERSION" == "latest" ]]; then - TAG_ARGS=("--tag" "$IMAGE:${LATEST_TAG#v}" "--tag" "$IMAGE:latest") + TAG_ARGS=("--tag" "${AZURITE_IMAGE%:*}:${LATEST_TAG#v}" "--tag" "${AZURITE_IMAGE%:*}:latest") else - TAG_ARGS=("--tag" "$IMAGE:${VERSION#v}") + TAG_ARGS=("--tag" "${AZURITE_IMAGE%:*}:${VERSION#v}") fi echo "Effective command line arguments:" ${ARCH[@]} ${VERSION_ARG[@]} ${TAG_ARGS[@]}