sudo: required

language: bash

services:
  - docker

before_install:
  - docker build -t uudashr/fibgo .
  - docker run -d --name fibgo-server -p 127.0.0.1:8080:8080 uudashr/fibgo
  - docker ps -a

script:
  - curl --fail http://127.0.0.1:8080/numbers || exit 1

after_success:
  - if [ "$TRAVIS_BRANCH" == "master" ]; then
    docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
    docker push uudashr/fibgo;
    fi

after_script:
  - docker stop fibgo-server
  - docker rm -v fibgo-server

sudo: required

language: bash

services:
  - docker

script:
  - docker build -t uudashr/fibgo .
  - docker run -d --name fibgo-server -p 127.0.0.1:8080:8080 uudashr/fibgo
  - docker ps -a
  - curl --fail http://127.0.0.1:8080/numbers || exit 1

after_success:
  - if [ "$TRAVIS_BRANCH" == "master" ]; then
      docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
      docker push uudashr/fibgo;
    fi

after_script:
  - docker stop fibgo-server
  - docker rm -v fibgo-server

Move the command to script (remove the before_install and install)
Move the command to script (remove the before_install and install)
