Add docker image build via Travis CI

Build the docker image in Travis. Push the result as latest version if
run from the master or next branch. Only push tagged commits from the
master branch as releases.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2017-06-17 23:40:15 +02:00
parent 676ab2e541
commit d91e2ce0e6

18
.travis.yml Normal file
View File

@ -0,0 +1,18 @@
sudo: required
services:
- docker
script:
- docker build -t kasproject/kas .
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ] || [ "$TRAVIS_BRANCH" == "next" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker push kasproject/kas;
if [ "$TRAVIS_BRANCH" == "master" ] && git describe --exact-match 2>/dev/null >/dev/null; then
VERSION="$(/usr/bin/python3 -c 'from kas.__version__ import __version__; print(__version__)')";
docker tag kasproject/kas kasproject/kas:$VERSION;
docker push kasproject/kas:$VERSION;
fi
fi