-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
28 lines (23 loc) · 1.54 KB
/
Makefile
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
RELEASE=$(shell git rev-parse HEAD)-$(shell date +"%Y-%m-%d-%H-%M-%S")
COMMIT=$(shell git rev-parse HEAD)
CLOUD=opszero-173723
run-docker:
docker build -t sonomafireinfo .
docker run -it -p 8081:80 sonomafireinfo
build:
sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
echo $$GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > ${HOME}/gcloud-service-key.json
sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
sudo /opt/google-cloud-sdk/bin/gcloud config set project $(CLOUD)
sudo docker build -t sonomafireinfo:$(RELEASE) .
sudo docker tag sonomafireinfo:$(RELEASE) gcr.io/opszero-173723/sonomafireinfo:$(RELEASE)
sudo /opt/google-cloud-sdk/bin/gcloud docker -- push gcr.io/opszero-173723/sonomafireinfo:$(RELEASE)
sudo docker tag sonomafireinfo:$(RELEASE) gcr.io/opszero-173723/sonomafireinfo:latest
sudo /opt/google-cloud-sdk/bin/gcloud docker -- push gcr.io/opszero-173723/sonomafireinfo:latest
deploy-%:
sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/$(shell curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
sudo chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
KUBECONFIG=./kubeconfig sudo -E /opt/google-cloud-sdk/bin/gcloud container clusters get-credentials sonomafireinfo --zone us-west1-a --project $(CLOUD)
sudo chmod 664 ./kubeconfig
KUBECONFIG=./kubeconfig kubectl set image --namespace $* deployment/sonomafireinfo sonomafireinfo=gcr.io/$(CLOUD)/sonomafireinfo:$(COMMIT)