sudo: required

dist: trusty

before_install:
  - sudo apt-get -y purge docker-engine
  - bash <(curl -fsSL https://get.docker.com/)
  - docker version
  - docker network create --driver=bridge --subnet=192.168.0.0/16 --opt="com.docker.network.driver.mtu=1450" --opt="com.docker.network.bridge.name=redd0" nanobox
  - ifconfig
  - docker pull nanobox/hoarder
  - docker build -t nanobox/build .

script:
  - sudo stdbuf -o0 test/run_all.sh
  - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)

after_success:
  - docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
  - docker build -t ${NAMESPACE}/build .
  - docker tag ${NAMESPACE}/build ${NAMESPACE}/build:beta;
  - docker push ${NAMESPACE}/build:beta;
  - if [ "$BRANCH" == "master" ]; then
    docker push ${NAMESPACE}/build;
    else
    docker tag ${NAMESPACE}/build ${NAMESPACE}/build:${BRANCH//\//_};
    docker push ${NAMESPACE}/build:${BRANCH//\//_};
    fi

sudo: required

dist: trusty

before_install:
  - sudo apt-get -y purge docker-engine
  - bash <(curl -fsSL https://get.docker.com/)
  - docker version
  - docker network create --driver=bridge --subnet=192.168.0.0/16 --opt="com.docker.network.driver.mtu=1450" --opt="com.docker.network.bridge.name=redd0" nanobox
  - ifconfig
  - docker pull nanobox/hoarder
  - docker build -t nanobox/build .

script:
  - sudo stdbuf -o0 test/run_all.sh

after_success:
  - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
  - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
  - docker build -t ${NAMESPACE}/build .
  - docker tag ${NAMESPACE}/build ${NAMESPACE}/build:beta;
  - docker push ${REMOTE}${NAMESPACE}/build:beta;
  - if [ "$BRANCH" == "master" ]; then
    docker push ${REMOTE}${NAMESPACE}/build;
    else
    docker tag ${NAMESPACE}/build ${NAMESPACE}/build:${BRANCH//\//_};
    docker push ${REMOTE}${NAMESPACE}/build:${BRANCH//\//_};
    fi

Allow using different docker repository
Allow using different docker repository
