steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/$GOOGLE_CLOUD_PROJECT/livewire-backend', '.']
  dir: 'server'

# Push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
  args: ['push', 'gcr.io/$GOOGLE_CLOUD_PROJECT/livewire-backend']

# Deploy container image to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
  args:
  - 'run'
  - 'deploy'
  - 'livewire-backend'
  - '--image'
  - 'gcr.io/$GOOGLE_CLOUD_PROJECT/livewire-backend'
  - '--region'
  - 'us-central1'
  - '--platform'
  - 'managed'
  - '--allow-unauthenticated'
  - '--port'
  - '8081'
  - '--set-env-vars'
  - 'GOOGLE_CLOUD_PROJECT=${GOOGLE_CLOUD_PROJECT},LOG_LEVEL=INFO'
  - '--service-account'
  - 'livewire-backend@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com'

images:
- 'gcr.io/$GOOGLE_CLOUD_PROJECT/livewire-backend' 