-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (29 loc) · 1.32 KB
/
Makefile
File metadata and controls
43 lines (29 loc) · 1.32 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
41
42
43
DOCKER_FILE := build/Dockerfile
NAMESPACE :=
ifndef DOCKER_NAMES
override DOCKER_NAMES = "${IMAGE_NAME}"
endif
sandbox-build: deps compile docker-build
all: sandbox-build docker-push
local: fmt deps compile docker-build docker-push
deps:
go mod tidy
GO111MODULE=on
update:
go get -u ./...
fmt:
gofmt -l -s -w .
compile:
CGO_ENABLED=0 go build -o ./build/_output/bin/pgskipper-replication-controller \
-gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} ./cmd/pgskipper-replication-controller
docker-build:
$(foreach docker_tag,$(DOCKER_NAMES),docker build --file="${DOCKER_FILE}" --pull -t $(docker_tag) ./;)
docker-push:
$(foreach docker_tag,$(DOCKER_NAMES),docker push $(docker_tag);)
clean:
rm -rf build/_output
test:
go test -v ./...
replace-image: local
$(foreach docker_tag,$(DOCKER_NAMES),kubectl patch deployment pgskipper-replication-controller -n $(NAMESPACE) --type "json" -p '[{"op":"replace","path":"/spec/template/spec/containers/0/image","value":'$(docker_tag)'},{"op":"replace","path":"/spec/template/spec/containers/0/imagePullPolicy","value":"Always"}, {"op":"replace","path":"/spec/replicas","value":0}]';)
$(foreach docker_tag,$(DOCKER_NAMES),kubectl patch deployment pgskipper-replication-controller -n $(NAMESPACE) --type "json" -p '[{"op":"replace","path":"/spec/replicas","value":1}]';)