forked from target/portauthority
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (73 loc) · 2.93 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
## Go parameters ##
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=portauthority
BINARY_MAC=$(BINARY_NAME)_mac
## Actions ##
all: clean deps build-mac build-linux
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_MAC)
run-mac: clean build-mac
./$(BINARY_MAC)
deps: | glide
@echo "Installing dependencies"
@glide install -v
## File Targets ##
deploy-minikube: clean-minikube
@echo "Deploying officially built Port Authority"
@echo "Applying Clair postgres deployment files"
kubectl apply -f ./minikube/clair/postgres
kubectl rollout status deployment/clair-postgres-deployment
sleep 5
@echo "Applying Clair deployment files"
kubectl apply -f ./minikube/clair/clair
kubectl rollout status deployment/clair-deployment
@echo "Applying portauthority postgres deployment files"
kubectl apply -f ./minikube/portauthority/postgres
kubectl rollout status deployment/portauthority-postgres-deployment
sleep 5
@echo "Applying portauthority deployment files"
kubectl apply -f ./minikube/portauthority/portauthority
kubectl rollout status deployment/portauthority-deployment
## File Targets ##
deploy-minikube-dev: clean build-linux docker-build clean-minikube
@echo "Deploying locally built devloper build of Port Authority"
@echo "Applying Clair postgres deployment files"
kubectl apply -f ./minikube/clair/postgres
kubectl rollout status deployment/clair-postgres-deployment
sleep 5
@echo "Applying Clair deployment files"
kubectl apply -f ./minikube/clair/clair
kubectl rollout status deployment/clair-deployment
@echo "Applying portauthority postgres deployment files"
kubectl apply -f ./minikube/portauthority/postgres
kubectl rollout status deployment/portauthority-postgres-deployment
sleep 5
@echo "Applying portauthority deployment files"
kubectl apply -f ./minikube/portauthority/portauthority-local
kubectl rollout status deployment/portauthority-deployment
clean-minikube:
@echo "Cleaning up previous portauthority deployments (postgres will remain)"
kubectl delete service portauthority-postgres-service --ignore-not-found
kubectl delete -f ./minikube/portauthority/portauthority --ignore-not-found
kubectl delete -f ./minikube/portauthority/portauthority-local --ignore-not-found
clean-minikube-postgres:
@echo "Cleaning Clair postgres database"
kubectl delete -f ./minikube/clair/postgres --ignore-not-found
@echo "Cleaning portauthority postgres database"
kubectl delete -f ./minikube/portauthority/postgres --ignore-not-found
## Builds ##
build-mac:
$(GOBUILD) -o $(BINARY_MAC)
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -ldflags "-X main.appVersion=local-dev" -o $(BINARY_NAME)
docker-build:
docker build -t $(BINARY_NAME) .
## Glide ##
glide:
@if ! hash glide 2>/dev/null; then curl https://glide.sh/get | sh; fi