Skip to content

Commit

Permalink
Merge pull request netbox-community#471 from joonas/travis/automated-…
Browse files Browse the repository at this point in the history
…docker-builds

travis: Automate docker builds
  • Loading branch information
Zach Moody authored Aug 16, 2016
2 parents c8a22a9 + 6f6fbe4 commit 7a6d7c6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
sudo: required

services:
- docker

env:
- DOCKER_TAG=$TRAVIS_TAG

language: python
python:
- "2.7"
Expand All @@ -6,3 +14,7 @@ install:
- pip install pep8
script:
- ./scripts/cibuild.sh
after_success:
- if [ ! -z "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
./scripts/docker-build.sh;
fi
21 changes: 21 additions & 0 deletions scripts/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
if [ $? -ne 0 ]; then
echo "docker login failed."
exit 1
fi

docker build -t "$DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:$DOCKER_TAG" .
if [ $? -ne 0 ]; then
echo "docker build failed."
exit 1
fi

docker push "$DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:$DOCKER_TAG"
if [ $? -ne 0 ]; then
echo "docker push failed."
exit 1
fi

exit 0

0 comments on commit 7a6d7c6

Please sign in to comment.