-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
142 lines (110 loc) · 3.18 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Vars
STG_TAG=stage
PROD_TAG=v0.0.1
IMAGE_NAME=kbs
# Misc
BINARY_NAME=baseapp
BINARY_UNIX=$(BINARY_NAME)_unix
all: test build
build:
go build -o ./bin/$(BINARY_NAME) ./cmd/$(BINARY_NAME).go
build-linux:
CGOENABLED=0 GOOS=linux GOARCH=amd64; go build -o ./bin/$(BINARY_UNIX) ./cmd/$(BINARY_NAME).go
clean:
go clean
rm -f ./bin/$(BINARY_NAME)
rm -f ./bin/$(BINARY_UNIX)
run:
./scripts/run.sh
package-resources:
pkger -include /assets/web/embed -o pkg/web
list-package-resources:
pkger list -include /assets/web --json
# Generators
gen-resource:
mw generate all assets/gen/resource.yaml
# Cloud
connect-stg:
gcloud beta container clusters get-credentials ${GC_STG_CLUSTER} --region ${GC_REGION} --project ${GC_STG_PROJECT}
connect-prod:
gcloud beta container clusters get-credentials ${GC_PROD_CLUSTER} --region ${GC_REGION} --project ${GC_PROD_PROJECT}
build-stg:
make build
docker login
docker build -t ${DOCKER_ACCOUNT}/$(IMAGE_NAME):$(STG_TAG) .
docker push ${DOCKER_ACCOUNT}/$(IMAGE_NAME):$(STG_TAG)
build-prod:
make build
docker login
docker build -t ${DOCKER_ACCOUNT}/$(IMAGE_NAME):$(PROD_TAG) .
docker push ${DOCKER_ACCOUNT}/$(IMAGE_NAME):$(PROD_TAG)
template-stg:
helm template --name $(IMAGE_NAME) -f ./deployments/helm/values-stg.yaml ./deployments/helm
template-prod:
helm template --name $(IMAGE_NAME) -f ./deployments/helm/values-prod.yaml ./deployments/helm
install-stg:
make connect-stg
helm install --name $(IMAGE_NAME) -f ./deployments/helm/values-stg.yaml ./deployments/helm
install-prod:
make connect-prod
helm install --name $(IMAGE_NAME) -f ./deployments/helm/values-prod.yaml ./deployments/helm
delete-stg:
make connect-stg
helm del --purge $(IMAGE_NAME)
delete-prod:
make connect-prod
helm del --purge $(IMAGE_NAME)
deploy-stg:
make build-stg
make connect-stg
make delete-stg
make install-stg
deploy-prod:
make build-prod
make connect-prod
make delete-prod
make install-prod
## Testing
test:
make -f makefile.test test-selected
grc-test:
grc make -f makefile.test test-selected
build-tests:
go test -c pkg/web/user_test.go pkg/web/base_test.go
build-test-compose:
#docker-compose rm postgres
docker-compose -f ./deployments/docker/docker-compose.test.yml up --build --abort-on-container-exit --remove-orphans
## Misc
custom-build:
make mod tidy; go mod vendor; go build ./...
clean-and-run:
clear
make package-resources
make run
gen-sample:
mw generate Sample --all --force
current-conn:
kubectl config current-context
grc-install:
sudo apt-get install grc
make grc-configure
spacer:
@echo "\n"
get-deps:
go get -u "github.com/aws/aws-sdk-go"
go get -u "github.com/go-chi/chi"
go get -u "github.com/gorilla/csrf"
go get -u "github.com/gorilla/schema"
go get -u "github.com/gorilla/sessions"
go get -u "github.com/jmoiron/sqlx"
go get -u "github.com/lib/pq"
go get -u "github.com/markbates/pkger"
go get -u "github.com/myesui/uuid"
go get -u "github.com/nicksnyder/go-i18n/v2"
go get -u "github.com/rs/zerolog"
go get -u "github.com/satori/go.uuid"
go get -u "golang.org/x/crypto"
go get -u "golang.org/x/text"
go get -u "google.golang.org/appengine"
go get -u "gopkg.in/DATA-DOG/go-sqlmock.v1"
go get -u "gopkg.in/stretchr/testify.v1"