commit
40195bb2e7
14
.travis.yml
14
.travis.yml
|
@ -3,16 +3,18 @@ language: bash
|
|||
services:
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
install:
|
||||
- sudo pip install --upgrade pip
|
||||
- pip install --user awscli
|
||||
- export PATH=$PATH:$HOME/.local/bin
|
||||
- echo $DOCKER_TOKEN | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
|
||||
install:
|
||||
docker build --no-cache -t sartography/cr-connect-db:latest . || exit 1;
|
||||
docker push sartography/cr-connect-db:latest || exit 1;
|
||||
aws sqs send-message --region 'us-east-1' --queue-url 'https://queue.amazonaws.com/474683445819/dcos-refresh' --message-body 'crconnect/db' || exit 1;
|
||||
deploy:
|
||||
provider: script
|
||||
script: bash deploy.sh
|
||||
skip_cleanup: true
|
||||
on:
|
||||
all_branches: true
|
||||
condition: $TRAVIS_BRANCH =~ ^(testing|staging|master)$
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Build and push Docker image to Docker Hub
|
||||
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
|
||||
APP="db"
|
||||
REPO="sartography/cr-connect-$APP"
|
||||
TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi)
|
||||
COMMIT=${TRAVIS_COMMIT::8}
|
||||
|
||||
docker build -f Dockerfile -t "$REPO:$COMMIT" . || 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
|
||||
|
||||
# Wait for Docker Hub
|
||||
echo "Publishing to Docker Hub..."
|
||||
sleep 30
|
||||
|
||||
# Notify UVA DCOS that Docker image has been updated
|
||||
echo "Refreshing DC/OS..."
|
||||
aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$TRAVIS_BRANCH/$APP" || exit 1
|
Loading…
Reference in New Issue