sudo: required

services:
  - docker

script:
  # The following 2 lines are from https://graysonkoonce.com/getting-the-current-branch-name-during-a-pull-request-in-travis-ci/
  - export PR=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
  - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo `curl -s $PR | jq -r .head.ref`; fi)
  - export REPO="dangmai/website:latest"
  - export CONTAINER_NAME="website"
  - if [ "$BRANCH" == "master" ]; then bash ./deploy/deploy.sh; fi

sudo: required

services:
  - docker

script:
  # The following 2 lines are from https://graysonkoonce.com/getting-the-current-branch-name-during-a-pull-request-in-travis-ci/
  - export PR=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
  - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo `curl -s $PR | jq -r .head.ref`; fi)
  - export REPO="dangmai/website:latest"
  - export CONTAINER_NAME="website"
  - bash ./deploy/build.sh
  - if [ "$BRANCH" == "master" ]; then bash ./deploy/deploy.sh -e HOST=$HOST -e EMAIL=$EMAIL; fi

Build the image first before pushing to DockerHub
Build the image first before pushing to DockerHub
