Created
November 27, 2015 07:44
-
-
Save jay-johnson/f17a3abe82eff91e7036 to your computer and use it in GitHub Desktop.
example .travis.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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