diff --git a/tools/cd.sh b/tools/cd.sh index 1b6b46df..591408a5 100755 --- a/tools/cd.sh +++ b/tools/cd.sh @@ -6,10 +6,15 @@ if [[ -z "$1" ]]; then echo "Usage: $0 " >&2; exit 1; fi set -o errexit +if [[ -z "${DOCKER_REGISTRY}" ]]; then + echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin +else + echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin "${DOCKER_REGISTRY}" + DOCKER_USERNAME="${DOCKER_REGISTRY}" +fi + docker build -t "${DOCKER_USERNAME}/doccano:latest" . docker build -t "${DOCKER_USERNAME}/doccano:$1" . -echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin - docker push "${DOCKER_USERNAME}/doccano:latest" docker push "${DOCKER_USERNAME}/doccano:$1"