-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-and-deploy.sh
28 lines (22 loc) · 1.01 KB
/
build-and-deploy.sh
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
#!/bin/bash
## Note: credentials files are created from env variables created with:
## base64 <credentials-file-example.json>
# Remove env vars
set -e
# Configure Google Cloud SDK
echo $GCLOUD_SERVICE_KEY | base64 --decode -i > ./Backend/creds.json
gcloud auth activate-service-account $GCLOUD_EMAIL --key-file ./Backend/creds.json
gcloud --quiet config set project $PROJECT_NAME
gcloud --quiet config set compute/zone $CLOUDSDK_COMPUTE_ZONE
docker-credential-gcr configure-docker --token-source="gcloud"
ssh-keygen -f ~/.ssh/google_compute_engine -N ""
# Build Backend
cd Backend/
docker build -f dockerfile -t gcr.io/how-it-does/backend:latest .
gcloud docker -- push gcr.io/how-it-does/backend:latest
kubectl rolling-update backend --image=gcr.io/how-it-does/backend:latest
# Move from backent to Frontend
cd ../Frontend/
docker build -f dockerfile -t gcr.io/how-it-does/frontend:latest .
gcloud docker -- push gcr.io/how-it-does/frontend:latest
kubectl rolling-update frontend --image=gcr.io/how-it-does/frontend:latest