docker.sh 798 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. # Copyright 2017-2020 @polkadot/apps authors & contributors
  3. # This software may be modified and distributed under the terms
  4. # of the Apache-2.0 license. See the LICENSE file for details.
  5. # fail fast on any non-zero exits
  6. set -e
  7. # the docker image name and dockerhub repo
  8. NAME="polkadot-js-apps"
  9. REPO="jacogr"
  10. # extract the current npm version from package.json
  11. VERSION=$(cat package.json \
  12. | grep version \
  13. | head -1 \
  14. | awk -F: '{ print $2 }' \
  15. | sed 's/[",]//g' \
  16. | sed 's/ //g')
  17. echo "*** Building $NAME"
  18. docker build -t $NAME .
  19. docker login -u $REPO -p $DOCKER_PASS
  20. echo "*** Tagging $REPO/$NAME"
  21. if [[ $VERSION != *"beta"* ]]; then
  22. docker tag $NAME $REPO/$NAME:$VERSION
  23. fi
  24. docker tag $NAME $REPO/$NAME
  25. echo "*** Publishing $NAME"
  26. docker push $REPO/$NAME