Table of Contents

Docker - Continuous integration

About

Docker integration with continuous integration system in order to build and publish

Travis

Build and deployment script to Docker Hub

#!/bin/sh
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
if [ "$TRAVIS_BRANCH" = "master" ]; then
    TAG="latest"
else
    TAG="$TRAVIS_BRANCH"
fi
docker build -f Dockerfile -t $TRAVIS_REPO_SLUG:$TAG .
docker push $TRAVIS_REPO_SLUG

where:

Deployment to Heroku

#!/bin/sh
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
heroku plugins:install heroku-container-registry
docker login -e _ -u _ --password=$HEROKU_API_KEY registry.heroku.com
heroku container:push web --app $HEROKU_APP_NAME

.travis.yml configuration file

after_success:
  - sh .travis/deploy_dockerhub.sh
  - test “$TRAVIS_BRANCH” = “master” && sh .travis/deploy_heroku.sh

where:

Documentation / Reference