2020-05-06 21:18:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Build and push Docker image to Docker Hub
|
|
|
|
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
|
|
|
APP="db"
|
2020-05-07 12:45:07 +00:00
|
|
|
REPO="sartography/cr-connect-$APP"
|
|
|
|
TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi)
|
2020-05-07 18:23:58 +00:00
|
|
|
COMMIT=${TRAVIS_COMMIT::8}
|
2020-05-07 18:16:17 +00:00
|
|
|
|
2020-05-07 12:45:07 +00:00
|
|
|
docker build -f Dockerfile -t "$REPO:$COMMIT" .
|
|
|
|
docker tag "$REPO:$COMMIT" "$REPO:$TAG"
|
|
|
|
docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER"
|
|
|
|
docker push "$REPO"
|
2020-05-06 21:18:34 +00:00
|
|
|
|
|
|
|
# Wait for Docker Hub
|
|
|
|
echo "Publishing to Docker Hub..."
|
|
|
|
sleep 30
|
|
|
|
|
|
|
|
# Notify UVA DCOS that Docker image has been updated
|
|
|
|
echo "Refreshing DC/OS..."
|
2020-05-07 12:45:07 +00:00
|
|
|
aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$TRAVIS_BRANCH/$APP"
|