-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild-prod.yaml
47 lines (41 loc) · 1.52 KB
/
cloudbuild-prod.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
steps:
# Create the .env.prod file with environment variables
- name: "gcr.io/cloud-builders/gcloud"
entrypoint: "bash"
args:
- "-c"
- |
echo "NEXT_PUBLIC_ROOT_URL=https://gw.dados.rio/plataforma-clima-staging" > .env.production && \
echo "NEXT_PUBLIC_MAPBOX_API_KEY=pk.eyJ1IjoiZXNjcml0b3Jpb2RlZGFkb3MiLCJhIjoiY2t3bWdmcHpjMmJ2cTJucWJ4MGQ1Mm1kbiJ9.4hHJX-1pSevYoBbja7Pq4w" >> .env.production
# Build the container image
- name: "gcr.io/cloud-builders/docker"
args:
["build", "-t", "gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA", "."]
# Push the container image to Container Registry
- name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA"]
# Kustomize: set the image in the kustomization.yaml file
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/prod"
entrypoint: "kustomize"
args:
- "edit"
- "set"
- "image"
- "gcr.io/project-id/plataforma-clima=gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA"
# Kustomize: apply the kustomization.yaml file
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/prod"
entrypoint: "kustomize"
args: ["build", ".", "-o", "prod.yaml"]
# Deploy the application to the GKE cluster
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/prod"
args:
- "run"
- "--filename=prod.yaml"
- "--location=us-central1"
- "--cluster=datario"
- "--project=datario"
images:
- "gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA"