Docker - Continuous integration

Card Puncher Data Processing

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:

  • the file deploy_dockerhub.sh and deploy_heroku.sh are located under a .travis directory in the code repository.

Documentation / Reference





Discover More
Card Puncher Data Processing
Docker - Publish

How to publish an image to a repository (for now docker hub) See also: For an image name as dockiql and my docker hub id as gerardnico



Share this page:
Follow us:
Task Runner