steps:
# slack deployment status
- name: 'gcr.io/cloud-builders/curl'
  args:
      [
          '-X',
          'POST',
          '-H',
          'Content-type: application/json',
          '--data',
          '{"text":"gcr.io/${PROJECT_ID}/${_IMAGE}:${_VERSION}${BRANCH_NAME}${TAG_NAME} build started!"}',
          '${_WEBHOOK_URL}',
      ]

- name: 'gcr.io/cloud-builders/docker'
  args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/$_IMAGE:$_VERSION$BRANCH_NAME$TAG_NAME', '-f', '$_VERSION/Dockerfile', '.' ]

# slack deployment status
- name: 'gcr.io/cloud-builders/curl'
  args:
      [
          '-X',
          'POST',
          '-H',
          'Content-type: application/json',
          '--data',
          '{"text":"gcr.io/${PROJECT_ID}/${_IMAGE}:${_VERSION}${BRANCH_NAME}${TAG_NAME} build completed!"}',
          '${_WEBHOOK_URL}',
      ]

# extend timeout to 40 min
timeout: 2400s

# store artifact
images: ['gcr.io/$PROJECT_ID/$_IMAGE:$_VERSION$BRANCH_NAME$TAG_NAME']

# arguments
substitutions:
  _IMAGE: php-fpm
  _VERSION: "7.4" # PHP runtime version
  _WEBHOOK_URL: https://hooks.slack.com/services/A/B/C # slack notifications
