sudo: false
language: node_js
services:
  - docker
node_js:
  - '4.2'
install:
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
  - npm i -g jshint
  - npm install
env:
  - DOCKER_IMAGE_NAME=swaggerapi/swagger-ui
after_success:
  - if [ $DOCKER_HUB_USERNAME ]; then 
      docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD;
      docker build -t $DOCKER_IMAGE_NAME .;
      if [ "$TRAVIS_TAG" != "master" && -z "$TRAVIS_TAG"]; then
        docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$TRAVIS_TAG;
      fi;

      docker push $DOCKER_IMAGE_NAME;
    fi;
