-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
36 lines (31 loc) · 1.59 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
25
26
27
28
29
30
31
32
33
34
35
36
steps:
# install dependencies
- name: 'node'
entrypoint: 'npm'
args: ['install', '--only-production']
# create the .env file
- name: 'node'
entrypoint: 'npm'
# this command must be created on the package.json file
args: ["run", "create-env"]
# you need to enter the env variables for the server in the cloud build > trigger page > advanced > substitution variables
env:
- 'OPENAI_API_KEY=${_OPENAI_API_KEY}'
- 'DATA_SERVICE_URL=${_DATA_SERVICE_URL}'
# create the docker image from the Dockerfile
- name: 'gcr.io/cloud-builders/docker'
# third parameter is ${SERVER_LOCATION}-docker.pkg.dev/${PROJECT_NAME}/${ARTIFACT_REPOSITORY_NAME}/${DOCKER_IMAGE_NAME}
# you can find it in the Artifact Registry page
# ${DOCKER_IMAGE_NAME} can be a new one
args: [ 'build', '-t', 'europe-west8-docker.pkg.dev/sdeservices/sde-services-docker/dalle-service', '.' ]
# save docker image to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
# same docker image name as before
args: ['push', 'europe-west8-docker.pkg.dev/sdeservices/sde-services-docker/dalle-service']
# Deploy container image to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
# the fifth parameter is the same docker image name as before
# the third one is the name of the service in the Cloud Run page (it can be a new name)
args: ['run', 'deploy', 'dalle-service', '--image', 'europe-west8-docker.pkg.dev/sdeservices/sde-services-docker/dalle-service', '--region', 'europe-north1', '--platform', 'managed']
images: ['europe-west8-docker.pkg.dev/sdeservices/sde-services-docker/dalle-service']