Skip to content

Instantly share code, notes, and snippets.

@jay-johnson
Created November 27, 2015 07:44
Show Gist options
  • Save jay-johnson/f17a3abe82eff91e7036 to your computer and use it in GitHub Desktop.
Save jay-johnson/f17a3abe82eff91e7036 to your computer and use it in GitHub Desktop.
example .travis.yml
sudo: required
language: ruby
services:
- docker
before_install:
- echo "Testing Docker Hub credentials"
- docker login -e=$DOCKER_EMAIL -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
- echo "Docker Hub credentials are working"
- docker build -t build-springxd-base .
script:
- docker ps -a
after_success:
- echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)"
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then echo -e "Push Container to Docker Hub"; fi
- docker login -e=$DOCKER_EMAIL -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
- export REPO=jayjohnson/springxd-base
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment