Only creates Docker tag for branch

This commit is contained in:
Aaron Louie 2020-05-14 08:52:59 -04:00
parent be325514f3
commit fa55806cdc
1 changed files with 1 additions and 5 deletions

View File

@ -14,7 +14,6 @@ function branch_to_deploy_stage () {
REPO="sartography/cr-connect-db" REPO="sartography/cr-connect-db"
TAG=$(branch_to_tag "$TRAVIS_BRANCH") TAG=$(branch_to_tag "$TRAVIS_BRANCH")
COMMIT=${TRAVIS_COMMIT::8}
DEPLOY_APP="db" DEPLOY_APP="db"
DEPLOY_GROUP=$(branch_to_deploy_group "$TRAVIS_BRANCH") DEPLOY_GROUP=$(branch_to_deploy_group "$TRAVIS_BRANCH")
@ -29,14 +28,11 @@ fi
DEPLOY_PATH="$DEPLOY_GROUP/$DEPLOY_STAGE/$DEPLOY_APP" DEPLOY_PATH="$DEPLOY_GROUP/$DEPLOY_STAGE/$DEPLOY_APP"
echo "REPO = $REPO" echo "REPO = $REPO"
echo "TAG = $TAG" echo "TAG = $TAG"
echo "COMMIT = $COMMIT"
echo "DEPLOY_PATH = $DEPLOY_PATH" echo "DEPLOY_PATH = $DEPLOY_PATH"
# Build and push Docker image to Docker Hub # Build and push Docker image to Docker Hub
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1 echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
docker build -f Dockerfile -t "$REPO:$COMMIT" . || exit 1 docker build -f Dockerfile -t "$REPO:$TAG" . || exit 1
docker tag "$REPO:$COMMIT" "$REPO:$TAG" || exit 1
docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER" || exit 1
docker push "$REPO" || exit 1 docker push "$REPO" || exit 1
# Wait for Docker Hub # Wait for Docker Hub