-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
64 lines (48 loc) · 2.7 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
# SPDX-FileCopyrightText: 2019-present Open Networking Foundation <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
export CGO_ENABLED=0
export GO111MODULE=on
.PHONY: build
ifdef VERSION
CONTROLLER_VERSION := $(VERSION)
else
CONTROLLER_VERSION := latest
endif
all: images
build: # @HELP build the source code
build:
go build -o build/bin/atomix-controller ./cmd/atomix-controller
go build -o build/bin/atomix-broker ./cmd/atomix-broker
go build -o build/bin/atomix-controller-init-certs ./cmd/atomix-controller-init-certs
controller-image:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -gcflags=-trimpath=${GOPATH} -asmflags=-trimpath=${GOPATH} -o build/docker/atomix-controller/bin/atomix-controller ./cmd/atomix-controller
docker build ./build/docker/atomix-controller -f build/docker/atomix-controller/Dockerfile -t atomix/atomix-controller:${CONTROLLER_VERSION}
broker-image:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -gcflags=-trimpath=${GOPATH} -asmflags=-trimpath=${GOPATH} -o build/docker/atomix-broker/bin/atomix-broker ./cmd/atomix-broker
docker build ./build/docker/atomix-broker -f build/docker/atomix-broker/Dockerfile -t atomix/atomix-broker:${CONTROLLER_VERSION}
init-certs-image:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -gcflags=-trimpath=${GOPATH} -asmflags=-trimpath=${GOPATH} -o build/docker/atomix-controller-init-certs/bin/atomix-controller-init-certs ./cmd/atomix-controller-init-certs
docker build ./build/docker/atomix-controller-init-certs -f build/docker/atomix-controller-init-certs/Dockerfile -t atomix/atomix-controller-init-certs:${CONTROLLER_VERSION}
images: controller-image broker-image init-certs-image
kind: images
@if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi
kind load docker-image atomix/atomix-controller:${CONTROLLER_VERSION}
kind load docker-image atomix/atomix-broker:${CONTROLLER_VERSION}
kind load docker-image atomix/atomix-controller-init-certs:${CONTROLLER_VERSION}
push: # @HELP push controller Docker image
docker push atomix/atomix-controller:${CONTROLLER_VERSION}
docker push atomix/atomix-broker:${CONTROLLER_VERSION}
docker push atomix/atomix-controller-init-certs:${CONTROLLER_VERSION}
test: # @HELP run the unit tests and source code validation
test: deps license linters
go test github.com/atomix/atomix-controller/cmd/...
go test github.com/atomix/atomix-controller/pkg/...
deps: # @HELP ensure that the required dependencies are in place
go build -v ./...
linters: # @HELP examines Go source code and reports coding problems
golangci-lint run
reuse-tool: # @HELP install reuse if not present
command -v reuse || python3 -m pip install reuse
license: reuse-tool # @HELP run license checks
reuse lint