Continuous Integration

Part 2, Lesson 3

Next, we’ll add continuous integration (CI), via Travis CI, to our projects…

Follow steps 1 and 2 of the Getting Started guide to enable Travis in the project.

To trigger a build, add a .travis.yml to the project root:

sudo: required

  - docker


  - sudo rm /usr/local/bin/docker-compose
  - curl -L${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
  - chmod +x docker-compose
  - sudo mv docker-compose /usr/local/bin

  - docker-compose -f docker-compose-dev.yml up --build -d

  - docker-compose -f docker-compose-dev.yml run users python test
  - docker-compose -f docker-compose-dev.yml run users flake8 project

  - docker-compose -f docker-compose-dev.yml down

Commit your changes, and then push to GitHub. This should trigger a new build, which should pass. Once done, add a file to the project root, adding the Travis status badge:

# Microservices with Docker, Flask, and React

[![Build Status](](

Be sure to replace YOUR_GITHUB_USERNAME with your actual GitHub username.

In terms of workflow, for now, while the project structure is still somewhat simple, we’ll:

  1. Code a new feature locally
  2. Commit and push code
  3. Ensure tests pass on Travis