-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (28 loc) · 1.03 KB
/
Copy pathMakefile
File metadata and controls
40 lines (28 loc) · 1.03 KB
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
SHELL := /bin/bash
.PHONY: run build build-alpine build-docker push-gcr deploy
all:
auth:
gcloud auth application-default login
create-project:
gcloud projects create sample-gke-api --name="Sample GKE API"
gcloud config set project sample-gke-api
gcloud auth application-default login
gcloud services enable endpoints.googleapis.com
create-cluster:
gcloud container clusters create sample-gke-api-cluster --zone us-central1-a --machine-type g1-small --num-nodes 1
gcloud config set container/cluster sample-gke-api-cluster
gcloud container clusters get-credentials sample-gke-api-cluster
run:
go build -o ./bin/api && ./bin/api
build:
go build -o ./bin/api
build-alpine:
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ./bin/api
build-docker:
docker build -f Dockerfile -t gcr.io/sample-google-project/api:latest .
push-gcr:
gcloud docker -- push gcr.io/sample-google-project/api:latest
deploy-api:
kubectl apply -f ./api-deployment.yaml && kubectl apply -f ./api-svc.yaml
deploy-ingress:
kubectl apply -f ./ingress.yaml