You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
803 B

  1. #!/usr/bin/env bash
  2. if [[ -z "${DOCKER_USERNAME}" ]]; then echo "Missing DOCKER_USERNAME environment variable" >&2; exit 1; fi
  3. if [[ -z "${DOCKER_PASSWORD}" ]]; then echo "Missing DOCKER_PASSWORD environment variable" >&2; exit 1; fi
  4. if [[ -z "$1" ]]; then echo "Usage: $0 <tag>" >&2; exit 1; fi
  5. set -o errexit
  6. if [[ -z "${DOCKER_REGISTRY}" ]]; then
  7. echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
  8. else
  9. echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin "${DOCKER_REGISTRY}"
  10. DOCKER_USERNAME="${DOCKER_REGISTRY}"
  11. fi
  12. docker build -t "${DOCKER_USERNAME}/doccano:latest" .
  13. docker build -t "${DOCKER_USERNAME}/doccano:$1" .
  14. docker push "${DOCKER_USERNAME}/doccano:latest"
  15. docker push "${DOCKER_USERNAME}/doccano:$1"