Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gcloud/cloudbuild.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
steps:
# Step 1: Build Docker image with a tag
- name: 'gcr.io/cloud-builders/docker'
args: [
'build', '-t', 'europe-west1-docker.pkg.dev/$PROJECT_ID/bonadocs-api/bonadocs-api:latest', '--build-arg', 'NPM_TOKEN=${_NPM_TOKEN}', '--build-arg', 'PORT=${_PORT}', '.'
]

# Step 2: Push the image to Google Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'europe-west1-docker.pkg.dev/$PROJECT_ID/bonadocs-api/bonadocs-api:latest']
Comment on lines +5 to +10
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using dynamic image tagging (e.g., based on commit hash or version number) instead of 'latest' to improve traceability and avoid potential issues with image caching in production deployments.

Suggested change
'build', '-t', 'europe-west1-docker.pkg.dev/$PROJECT_ID/bonadocs-api/bonadocs-api:latest', '--build-arg', 'NPM_TOKEN=${_NPM_TOKEN}', '--build-arg', 'PORT=${_PORT}', '.'
]
# Step 2: Push the image to Google Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'europe-west1-docker.pkg.dev/$PROJECT_ID/bonadocs-api/bonadocs-api:latest']
'build', '-t', 'europe-west1-docker.pkg.dev/$PROJECT_ID/bonadocs-api/bonadocs-api:${SHORT_SHA}', '--build-arg', 'NPM_TOKEN=${_NPM_TOKEN}', '--build-arg', 'PORT=${_PORT}', '.'
]
# Step 2: Push the image to Google Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'europe-west1-docker.pkg.dev/$PROJECT_ID/bonadocs-api/bonadocs-api:${SHORT_SHA}']

Copilot uses AI. Check for mistakes.

# Step 3: Deploy to Cloud Run with the tagged image
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
args:
- gcloud
- run
- deploy
- bonadocs-api
- --image=europe-west1-docker.pkg.dev/$PROJECT_ID/bonadocs-api/bonadocs-api:latest
- --region=europe-west1
- --platform=managed
- --allow-unauthenticated

images:
- europe-west1-docker.pkg.dev/$PROJECT_ID/bonadocs-api/bonadocs-api:latest
options:
logging: CLOUD_LOGGING_ONLY
Loading