language: java

sudo: required

services:
  - docker

jdk:
  - oraclejdk8

script:
  - ./gradlew check installDist &&
    cp docker/Dockerfile georocket-server/build/install/Dockerfile &&
    docker build -t georocket/georocket georocket-server/build/install &&
    cd georocket-server/integration-tests &&
    ./test.sh &&
    cd ../.. &&
    if ([ "$TRAVIS_BRANCH" == "master" ] || [ ! -z "$TRAVIS_TAG" ]) && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
    docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" &&
    docker push georocket/georocket;
    fi

cache:
  directories:
    - $HOME/.gradle

language: java

sudo: required

services:
  - docker

jdk:
  - oraclejdk8

before_install:
  - |
    if [ ! -e /usr/local/bin/docker-compose ]; then
      #get latest docker compose released tag
      docker_compose_version="$(git ls-remote https://github.com/docker/compose | grep "refs/tag" | grep -oP "[0-9]+\.[0-9]+\.[0-9]+" | tail -n1)"
      # Install docker-compose
      sudo sh -c "curl -L https://github.com/docker/compose/releases/download/$docker_compose_version/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
      sudo chmod +x /usr/local/bin/docker-compose
      docker-compose --version
    fi

script:
  - ./gradlew check installDist &&
    cp docker/Dockerfile georocket-server/build/install/Dockerfile &&
    docker build -t georocket/georocket georocket-server/build/install &&
    cd georocket-server/integration-tests &&
    ./test.sh &&
    cd ../.. &&
    if ([ "$TRAVIS_BRANCH" == "master" ] || [ ! -z "$TRAVIS_TAG" ]) && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
    docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" &&
    docker push georocket/georocket;
    fi

cache:
  directories:
    - $HOME/.gradle

Install docker-compose if it's not already
Install docker-compose if it's not already