-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
24 lines (22 loc) · 980 Bytes
/
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:
# Create environment variables for the build
- name: node:10.15.1
entrypoint: npm
args: ["run", "create-env"]
env:
- 'DISCORD_TOKEN=${_DISCORD_TOKEN}'
- 'OPENAI_API_KEY=${_OPENAI_API_KEY}'
- 'CLIENT_ID=${_CLIENT_ID}'
- 'FIRESTORE_CLIENT_EMAIL=${_FIRESTORE_CLIENT_EMAIL}'
- 'FIRESTORE_PRIVATE_KEY=${_FIRESTORE_PRIVATE_KEY}'
# Build the Docker image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/joi:$COMMIT_SHA', '.']
# Push the Docker image to Google Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/joi:$COMMIT_SHA']
# Update the container image on the Google Compute Engine instance
- name: gcr.io/cloud-builders/gcloud
args: [ 'compute', 'instances', 'update-container', 'joi-instance-backup', '--zone=europe-central2-a', '--container-image', 'gcr.io/$PROJECT_ID/joi:$COMMIT_SHA' ]
images:
- gcr.io/$PROJECT_ID/joi:$COMMIT_SHA