-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild-staging.yaml
43 lines (42 loc) · 1.55 KB
/
cloudbuild-staging.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
steps:
# Create the .env file
- name: "gcr.io/cloud-builders/gcloud"
entrypoint: "bash"
args:
- "-c"
- |
echo "NEXT_PUBLIC_CIVITAS_API_URL=https://gw.dados.rio/civitas-staging" > .env.production && \
echo "NEXT_PUBLIC_GW_API_URL=https://gw.dados.rio" >> .env.production && \
echo "NEXT_PUBLIC_VISION_AI_URL=https://staging.app.dados.rio/vision-ai" >> .env.production && \
echo "MAPBOX_ACCESS_TOKEN=${_MAPBOX_ACCESS_TOKEN}" >> .env.production
# Build the container image
- name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "gcr.io/$PROJECT_ID/civitas:$COMMIT_SHA", "."]
# Push the container image to Container Registry
- name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/$PROJECT_ID/civitas:$COMMIT_SHA"]
# Kustomize: set the image in the kustomization.yaml file
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/staging"
entrypoint: "kustomize"
args:
- "edit"
- "set"
- "image"
- "gcr.io/project-id/civitas=gcr.io/$PROJECT_ID/civitas:$COMMIT_SHA"
# Kustomize: apply the kustomization.yaml file
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/staging"
entrypoint: "kustomize"
args: ["build", ".", "-o", "staging.yaml"]
# Deploy the application to the GKE cluster
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/staging"
args:
- "run"
- "--filename=staging.yaml"
- "--location=us-central1"
- "--cluster=datario"
- "--project=datario"
images:
- "gcr.io/$PROJECT_ID/civitas:$COMMIT_SHA"