-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild-prod.yaml
40 lines (39 loc) · 1.28 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
steps:
# Create the .env file
- name: "gcr.io/cloud-builders/gcloud"
entrypoint: "bash"
args:
- "-c"
- |
echo "NEXT_PUBLIC_API_URL=https://registry.dados.rio/" > .env.production
# Build the container image
- name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "gcr.io/$PROJECT_ID/registry-app:$COMMIT_SHA", "."]
# Push the container image to Container Registry
- name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/$PROJECT_ID/registry-app:$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/registry-app=gcr.io/$PROJECT_ID/registry-app:$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/registry-app:$COMMIT_SHA"