2020-06-12 20:15:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function branch_to_tag () {
|
2020-06-12 21:04:04 +00:00
|
|
|
if [ "$1" == "master" ]; then echo "latest"; else echo "$1" ; fi
|
2020-06-12 20:15:31 +00:00
|
|
|
}
|
|
|
|
|
2020-06-12 20:49:41 +00:00
|
|
|
REPO="sartography/cr-connect-python-base"
|
2020-06-12 20:15:31 +00:00
|
|
|
TAG=$(branch_to_tag "$TRAVIS_BRANCH")
|
|
|
|
|
|
|
|
# Build and push Docker image to Docker Hub
|
|
|
|
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
|
|
|
|
docker build -f Dockerfile -t "$REPO:$TAG" . || exit 1
|
|
|
|
docker push "$REPO" || exit 1
|