matrix:
 include:
  - os: linux
    dist: trusty
  - os: osx

language: go

go:
 - 1.8

go_import_path: github.com/google/cloudprober

services:
 - docker

after_success:
 - CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' ./cmd/cloudprober.go
 - cp /etc/ssl/certs/ca-certificates.crt .
 - test -n "$DOCKER_IMAGE" && docker build -t ${DOCKER_IMAGE}:latest . && docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && docker push ${DOCKER_IMAGE}

matrix:
 include:
  - os: linux
    dist: trusty
  - os: osx

language: go

go:
 - 1.8

go_import_path: github.com/google/cloudprober

services:
 - docker

after_success:
 - CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' ./cmd/cloudprober.go
 - cp /etc/ssl/certs/ca-certificates.crt .
 - test -n "$DOCKER_IMAGE" && test "$TRAVIS_OS_NAME" = "linux" && docker build -t ${DOCKER_IMAGE}:latest . && docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && docker push ${DOCKER_IMAGE}

Build and push docker image only on Linux
Build and push docker image only on Linux

Update .travis.yml to build and push docker image only on Linux