-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
24 lines (22 loc) · 1.11 KB
/
cloudbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
script: |
docker build -t ${LOCATION}-docker.pkg.dev/$PROJECT_ID/globe-and-citizen-docker-repo/${REPO_FULL_NAME}:$COMMIT_SHA .
automapSubstitutions: true
id: 'Build The Image'
# Push the image to Google Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', '${LOCATION}-docker.pkg.dev/$PROJECT_ID/globe-and-citizen-docker-repo/${REPO_FULL_NAME}:$COMMIT_SHA' ]
id: 'Push The Image'
waitFor:
- 'Build The Image'
# Run the container in Cloud run
- name: 'gcr.io/cloud-builders/gcloud'
args: [ 'run', 'deploy', '${REPO_NAME}', '--image', '${LOCATION}-docker.pkg.dev/$PROJECT_ID/globe-and-citizen-docker-repo/${REPO_FULL_NAME}:$COMMIT_SHA', '--region', '${LOCATION}', '--platform', 'managed', '--allow-unauthenticated', '--port', '80', '--tag', '${SHORT_SHA}' ]
id: 'Deploy to Cloud Run'
waitFor:
- 'Push The Image'
# Push the image to Google Artifact Registry
images:
- '${LOCATION}-docker.pkg.dev/$PROJECT_ID/globe-and-citizen-docker-repo/${REPO_FULL_NAME}:$COMMIT_SHA'