sudo: required
dist: trusty
group: edge
services:
  - docker
env:
  - NODEJS_VERSION='6'
  - NODEJS_VERSION='7'
  - NODEJS_VERSION='8'
before_install:
  - docker pull node:${NODEJS_VERSION}
  - >
      docker run
      -v "$PWD":/usr/src/app
      -w /usr/src/app
      node:${NODEJS_VERSION}
      /bin/bash -c "npm -q install --no-optional"
script:
  - >
      docker run
      -v "$PWD":/usr/src/app
      -w /usr/src/app
      node:${NODEJS_VERSION}
      /bin/bash -c "npm test"
after_success:
  - >
      docker run
      -v "$PWD":/usr/src/app
      -w /usr/src/app
      node:${NODEJS_VERSION}
      /bin/bash -c "npm run build"
deploy:
  provider: pages
  skip_cleanup: true
  local_dir: dist
  github_token: $GITHUB_TOKEN
  condition: "$NODEJS_VERSION = 8"

sudo: required
dist: trusty
group: edge
services:
  - docker
env:
  - NODEJS_VERSION='6'
  - NODEJS_VERSION='7'
  - NODEJS_VERSION='8'
before_install:
  - docker pull node:${NODEJS_VERSION}
  - >
      docker run
      -v "$PWD":/usr/src/app
      -w /usr/src/app
      -u $(id -u)
      node:${NODEJS_VERSION}
      /bin/bash -c "npm -q install --no-optional"
script:
  - >
      docker run
      -v "$PWD":/usr/src/app
      -w /usr/src/app
      -u $(id -u)
      node:${NODEJS_VERSION}
      /bin/bash -c "npm test"
after_success:
  - >
      docker run
      -v "$PWD":/usr/src/app
      -w /usr/src/app
      -u $(id -u)
      node:${NODEJS_VERSION}
      /bin/bash -c "npm run build"
deploy:
  provider: pages
  skip_cleanup: true
  local_dir: dist
  github_token: $GITHUB_TOKEN
  condition: "$NODEJS_VERSION = 8"

Set Travis CI Docker UID to external UID
Set Travis CI Docker UID to external UID

Hopefully will fix some permissions issues.
