-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
77 lines (58 loc) · 2.24 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
VERSION ?= $(shell git describe --tags --always )
TARGET ?= $(shell basename `git rev-parse --show-toplevel`)
TEST ?= $(shell go list ./... | grep -v /vendor/)
REPOSITORY := mattdeboer/${TARGET}
DOCKER_IMAGE ?= ${REPOSITORY}:${VERSION}
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
REVISION ?= $(shell git rev-parse HEAD)
LD_FLAGS ?= -s -X github.com/matt-deboer/${TARGET}/pkg/version.Name=$(TARGET) \
-X github.com/matt-deboer/${TARGET}/pkg/version.Revision=$(REVISION) \
-X github.com/matt-deboer/${TARGET}/pkg/version.Branch=$(BRANCH) \
-X github.com/matt-deboer/${TARGET}/pkg/version.Version=$(VERSION)
default: test build
test:
go test -v -cover -run=$(RUN) $(TEST)
build: clean
@go build -v -o bin/$(TARGET) -ldflags "$(LD_FLAGS)+local_changes" ./pkg/server
pkg/ui/build:
cd pkg/ui && npm run release
release-ui: pkg/ui/build
@go get github.com/jteeuwen/go-bindata/...
go-bindata -o pkg/server/ui.go -prefix "pkg/ui/build" pkg/ui/build/...
release: clean release-ui
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \
-a -tags netgo \
-a -installsuffix cgo \
-ldflags "$(LD_FLAGS)" \
-o bin/$(TARGET) ./pkg/server
ca-certificates.crt:
@-docker rm -f ${TARGET}_cacerts
@docker run --name ${TARGET}_cacerts debian:latest bash -c 'apt-get update && apt-get install -y ca-certificates'
@docker cp ${TARGET}_cacerts:/etc/ssl/certs/ca-certificates.crt .
@docker rm -f ${TARGET}_cacerts
docker: ca-certificates.crt release
@echo "Building ${DOCKER_IMAGE}..."
@docker build -t ${DOCKER_IMAGE} -f Dockerfile .
pkg/ui/test-proxy/node_modules:
cd pkg/ui && npm run build-test-proxy
pkg/ui/node_modules:
cd pkg/ui && npm install
analyze-ui:
cd pkg/ui && npm run build && npm run analyze
dev-ui: | pkg/ui/node_modules pkg/ui/test-proxy/node_modules
# now move to the ui dir and run dev
cd pkg/ui && npm run dev
minidev: build pkg/ui/node_modules
hack/minikube-dev.sh
currentdev: build pkg/ui/node_modules
hack/current-context-dev.sh
acceptance:
hack/acceptance-tests.sh
acceptance-dev:
cd pkg/ui && CYPRESS_baseUrl=http://localhost:3000 npm run cypress:open
start-ui: | pkg/ui/node_modules pkg/ui/test-proxy/node_modules
cd pkg/ui && npm start
clean-ui:
@rm -rf pkg/ui/build
clean:
@rm -rf bin/