-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild-staging.yaml
47 lines (46 loc) · 1.89 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
44
45
46
47
steps:
# Create the .env file
- name: "gcr.io/cloud-builders/gcloud"
entrypoint: "bash"
args:
- "-c"
- |
echo "NEXT_PUBLIC_HCI_API_URL=${_NEXT_PUBLIC_HCI_API_URL}" > .env.production && \
echo "CAPTCHA_V2_SECRET_KEY=${_CAPTCHA_V2_SECRET_KEY}" >> .env.production && \
echo "CAPTCHA_V3_SECRET_KEY=${_CAPTCHA_V3_SECRET_KEY}" >> .env.production && \
echo "NEXT_PUBLIC_CAPTCHA_V2_SITE_KEY=${_NEXT_PUBLIC_CAPTCHA_V2_SITE_KEY}" >> .env.production && \
echo "NEXT_PUBLIC_CAPTCHA_V3_SITE_KEY=${_NEXT_PUBLIC_CAPTCHA_V3_SITE_KEY}" >> .env.production && \
echo "GOOGGLE_ANALYTICS_ID=${_GOOGGLE_ANALYTICS_ID}" >> .env.production && \
echo "GOOGLE_TAG_MANAGER_ID=${_GOOGLE_TAG_MANAGER_ID}" >> .env.production && \
echo "HOTJAR_ID=${_HOTJAR_ID}" >> .env.production
# Build the container image
- name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "gcr.io/$PROJECT_ID/hci:staging-$COMMIT_SHA", "."]
# Push the container image to Container Registry
- name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/$PROJECT_ID/hci:staging-$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/hci=gcr.io/$PROJECT_ID/hci:staging-$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/hci:staging-$COMMIT_SHA"