-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
81 lines (67 loc) · 2.76 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
GOOS=linux
GOARCH=amd64
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
CONTROLLER_BINARY_NAME=jiminy
CONTROLLER_BINARY_UNIX=$(CONTROLLER_BINARY_NAME)_unix
PLUGIN_BINARY_NAME_1=wob-v0
PLUGIN_BINARY_UNIX=$(PLUGIN_BINARY_NAME)_unix
PLUGIN_FOLDER_1=./plugin-go-grpc
PLUGIN_FOLDER_2=./plugin-get-dom
PLUGIN_BINARY_NAME_2=wob-v1
VERSION=0.1.0
all:build
build:
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(CONTROLLER_BINARY_NAME) -v
proto:
protoc -I proto/ proto/env.proto --go_out=plugins=grpc:proto/
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -rf $(CONTROLLER_BINARY_NAME)
rm -rf $(PLUGIN_FOLDER_1)/$(PLUGIN_BINARY_NAME_1)
rm -rf $(PLUGIN_FOLDER_1)/$(PLUGIN_BINARY_NAME_1).zip
rm -rf $(PLUGIN_FOLDER_2)/$(PLUGIN_BINARY_NAME_2)
rm -rf $(PLUGIN_FOLDER_2)/$(PLUGIN_BINARY_NAME_2).zip
run:
export ENV_PLUGIN="./$(PLUGIN_BINARY_NAME)"
./$(CONTROLLER_BINARY_NAME)
plugin-v1:
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(PLUGIN_FOLDER_1)/$(PLUGIN_BINARY_NAME_1) -v $(PLUGIN_FOLDER_1)
plugin-v2:
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(PLUGIN_FOLDER_2)/$(PLUGIN_BINARY_NAME_2) -v $(PLUGIN_FOLDER_2)
install:
$(GOBUILD) -o $(GOPATH)/bin/$(CONTROLLER_BINARY_NAME)
docker:
#env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(PLUGIN_FOLDER_1)/$(PLUGIN_BINARY_NAME_1) -v $(PLUGIN_FOLDER_1)
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(PLUGIN_FOLDER_2)/$(PLUGIN_BINARY_NAME_2) -v $(PLUGIN_FOLDER_2)
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(CONTROLLER_BINARY_NAME) -v
#jiminy zip plugin-go-grpc/
jiminy zip plugin-get-dom/
DOCKER_BUILDKIT=1 docker build . -t sibeshkar/jiminy-env:$(VERSION) --force-rm
docker-d:
#env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(PLUGIN_FOLDER_1)/$(PLUGIN_BINARY_NAME_1) -v $(PLUGIN_FOLDER_1)
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(PLUGIN_FOLDER_2)/$(PLUGIN_BINARY_NAME_2) -v $(PLUGIN_FOLDER_2)
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(CONTROLLER_BINARY_NAME) -v
jiminy zip plugin-go-grpc/
jiminy zip plugin-get-dom/
docker build . -t sibeshkar/jiminy-env:detached -f Dockerfile.detached --force-rm
docker-run:
docker run -it --rm -p 5901:5900 -p 15901:15900 --memory="500m" -p 84:6080 sibeshkar/jiminy-env:$(VERSION)
docker-run-d:
docker run -it --rm -p 5901:5900 -p 15901:15900 --memory="500m" -p 84:6080 sibeshkar/jiminy-env:detached
docker-record:
docker run -it --rm -p 5901:5901 -p 15901:15900 --memory="500m" -p 84:6080 sibeshkar/jiminy-env:$(VERSION)
docker-push:
docker push sibeshkar/jiminy-env:$(VERSION)
#docker push sibeshkar/jiminy-env:detached
# Cross compilation
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v
docker-build:
docker run --rm -it -v "$(GOPATH)":/go -w /go/src/bitbucket.org/rsohlich/makepost golang:latest go build -o "$(BINARY_UNIX)" -v