-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
99 lines (95 loc) · 4.04 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
steps:
# Para para generar un .env para que sea tomado por el step de build.
# Las variables serán tomadas de la definición del "trigger",
# "variables de sustitución", en Google Cloud Build.
# en gcp, se tiene que poner como nombre de cada variable, el unserscore
# como prefijo. Ejemplo: "_APP_ENV"
#
- name: 'gcr.io/cloud-builders/npm'
id: CreateEnv
args: ['run', 'create-env']
env:
- NODE_ENV=${_NODE_ENV}
- MONGODB=${_MONGODB}
- GAMMA_SERVICE_URL=${_GAMMA_SERVICE_URL}
- GRAPH_URL=${_GRAPH_URL}
- WALLET_CONNECT_PROJECT_ID=${_WALLET_CONNECT_PROJECT_ID}
- NODE_PROVIDER_MUMBAI_URL=${_CHAIN_NODE_PROVIDER_URL}
- NODE_PROVIDER_BSC_TESTNET_URL=${_NODE_PROVIDER_BSC_TESTNET_URL}
- NODE_PROVIDER_OPBNB_TESTNET=${_NODE_PROVIDER_OPBNB_TESTNET}
- MAIL_CLIENT=${_MAIL_CLIENT}
- MAIL_FROM=${_MAIL_FROM}
- MAIL_TO=${_MAIL_TO}
- MAIL_ETHEREAL_HOST=${_MAIL_ETHEREAL_HOST}
- MAIL_ETHEREAL_PORT=${_MAIL_ETHEREAL_PORT}
- MAIL_ETHEREAL_USER=${_MAIL_ETHEREAL_USER}
- MAIL_ETHEREAL_PSWD=${_MAIL_ETHEREAL_PSWD}
- MAIL_SG_KEY=${_MAIL_SG_KEY}
- MAIL_SG_FROM=${_MAIL_SG_FROM}
- NEXT_PUBLIC_APP_ENV=${_NEXT_PUBLIC_APP_ENV}
- NEXT_PUBLIC_STORAGE_URL_ALPHA=${_NEXT_PUBLIC_STORAGE_URL_ALPHA}
- NEXT_PUBLIC_STORAGE_URL_GAMMA=${_NEXT_PUBLIC_STORAGE_URL_GAMMA}
- NEXT_PUBLIC_ADMIN_ACCOUNTS=${_NEXT_PUBLIC_ADMIN_ACCOUNTS}
- NOF_VERSION=${_NOF_VERSION}
# build the container images
- name: "gcr.io/cloud-builders/docker"
id: Build
args: [
"build",
"--no-cache",
"-t",
"$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA",
"--build-arg", "NODE_ENV=${_NODE_ENV}",
"--build-arg", "MONGODB=${_MONGODB}",
"--build-arg", "GAMMA_SERVICE_URL=${_GAMMA_SERVICE_URL}",
"--build-arg", "GRAPH_URL=${_GRAPH_URL}",
"--build-arg", "WALLET_CONNECT_PROJECT_ID=${_WALLET_CONNECT_PROJECT_ID}",
"--build-arg", "NODE_PROVIDER_MUMBAI_URL=${_NODE_PROVIDER_MUMBAI_URL}",
"--build-arg", "NODE_PROVIDER_BSC_TESTNET_URL=${_NODE_PROVIDER_BSC_TESTNET_URL}",
"--build-arg", "NODE_PROVIDER_OPBNB_TESTNET=${_NODE_PROVIDER_OPBNB_TESTNET}",
"--build-arg", "MAIL_CLIENT=${_MAIL_CLIENT}",
"--build-arg", "MAIL_FROM=${_MAIL_FROM}",
"--build-arg", "MAIL_TO=${_MAIL_TO}",
"--build-arg", "MAIL_ETHEREAL_HOST=${_MAIL_ETHEREAL_HOST}",
"--build-arg", "MAIL_ETHEREAL_PORT=${_MAIL_ETHEREAL_PORT}",
"--build-arg", "MAIL_ETHEREAL_USER=${_MAIL_ETHEREAL_USER}",
"--build-arg", "MAIL_ETHEREAL_PSWD=${_MAIL_ETHEREAL_PSWD}",
"--build-arg", "MAIL_SG_KEY=${_MAIL_SG_KEY}",
"--build-arg", "MAIL_SG_FROM=${_MAIL_SG_FROM}",
"--build-arg", "NEXT_PUBLIC_APP_ENV=${_NEXT_PUBLIC_APP_ENV}",
"--build-arg", "NEXT_PUBLIC_STORAGE_URL_ALPHA=${_NEXT_PUBLIC_STORAGE_URL_ALPHA}",
"--build-arg", "NEXT_PUBLIC_STORAGE_URL_GAMMA=${_NEXT_PUBLIC_STORAGE_URL_GAMMA}",
"--build-arg", "NEXT_PUBLIC_ADMIN_ACCOUNTS=${_NEXT_PUBLIC_ADMIN_ACCOUNTS}",
"--build-arg", "NOF_VERSION=${_NOF_VERSION}",
"."
]
# push the container images to Container Registry
- name: "gcr.io/cloud-builders/docker"
id: Push
args: [
"push",
"$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA"
]
# Deploy container images to Cloud Run
- name: "gcr.io/cloud-builders/gcloud"
id: Deploy
entrypoint: gcloud
args: [
"run",
"deploy",
"$_SERVICE_NAME",
"--platform",
"managed",
"--region",
"$_DEPLOY_REGION",
"--image",
"$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA",
"--labels",
"managed-by=gcp-cloud-build-deploy-cloud-run,commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID",
"--quiet",
"--allow-unauthenticated",
]
images:
- $_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA
options:
logging: CLOUD_LOGGING_ONLY