---
pipeline:
  build:
    # Do things
    privileged: true
    image: docker:stable-dind
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    commands:
      - docker build -f Dockerfile.prod .
    when:
      event: [pull_request]

  docker-publish-dev:
    group: publish
    image: plugins/docker
    dockerfile: Dockerfile.dev
    repo: rancher/docs
    context: .
    tag: dev
    secrets: [docker_username, docker_password]
    when:
      branch: master
      event: push

  docker-publish-staging:
    group: publish
    image: plugins/docker
    dockerfile: Dockerfile.staging
    repo: rancher/docs
    context: .
    tag: staging
    secrets: [docker_username, docker_password]
    when:
      branch: master
      event: push

  docker-publish-latest:
    group: publish
    image: plugins/docker
    dockerfile: Dockerfile.prod
    repo: rancher/docs
    context: .
    tag: latest
    secrets: [docker_username, docker_password]
    when:
      branch: master
      event: push
