# In this directory, run the following command to build this builder.
# $ gcloud builds submit . --config=cloudbuild.yaml

# See Rocker documentation at https://github.com/grammarly/rocker

steps:
# Build rocker.
- name: 'gcr.io/cloud-builders/go:1.9.4'
  args: ['get', 'github.com/grammarly/rocker']
  env: ['GOPATH=.', 'GO15VENDOREXPERIMENT=1']
# Package it into a docker image.
- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/$PROJECT_ID/rocker', '.']
# Test the rocker build step that we just built.
- name: 'gcr.io/$PROJECT_ID/rocker'
  args: ['--version']
# Use Rockerfile to Build the image 'rocker-built-rocker'.
- name: 'gcr.io/$PROJECT_ID/rocker'
  args: ['build', '-f', 'Rockerfile', '.']
# Confirm that rocker successfully built rocker-built-rocker.
- name: 'rocker-built-rocker'
  args: ['--version']

# Push the rocker builder image.
images:
- 'gcr.io/$PROJECT_ID/rocker'
tags: ['cloud-builders-community']
