-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
57 lines (51 loc) · 1.24 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
steps:
- id: "copy env"
name: gcr.io/cloud-builders/git
args:
- "-c"
- |
echo "$$ENV_FILE" >> .env
chmod 400 .env
entrypoint: bash
secretEnv:
- ENV_FILE
- id: "build image"
name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args:
[
"-c",
"docker build --build-arg ENV_FILE=.env -t gcr.io/${PROJECT_ID}/${_SERVICE_NAME} . ",
]
- id: "push image"
name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/${PROJECT_ID}/${_SERVICE_NAME}"]
- id: "run deploy"
name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
entrypoint: gcloud
args:
[
"run",
"deploy",
"${_SERVICE_NAME}",
"--platform",
"managed",
"--region",
"${_REGION}",
"--image",
"gcr.io/${PROJECT_ID}/${_SERVICE_NAME}",
"--port",
"${_PORT}",
"--allow-unauthenticated",
]
substitutions:
_REGION: us-west1
_SERVICE_NAME: greenflags-frontend
_SECRET_NAME: frontend_env
_PORT: "8080"
images:
- "gcr.io/${PROJECT_ID}/${_SERVICE_NAME}"
availableSecrets:
secretManager:
- versionName: projects/${PROJECT_ID}/secrets/${_SECRET_NAME}/versions/latest
env: ENV_FILE