Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (62 loc) · 2.12 KB
/
Copy pathMakefile
File metadata and controls
78 lines (62 loc) · 2.12 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
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
MESHNET_DOCKER_IMAGE ?= us-west1-docker.pkg.dev/kne-external/kne/meshnet
BRIDGE_DOCKER_IMAGE ?= us-west1-docker.pkg.dev/kne-external/kne/bridge
GOPATH ?= ${HOME}/go
KNE_CLI_BIN := kne
INSTALL_DIR := /usr/local/bin
COMMIT := $(shell git describe --dirty --always 2>/dev/null || echo unknown)
# Match KNE's own release tags and not a component's: a bare `git describe`
# returns whichever was tagged most recently, which is usually
# third_party/meshnet/vX.Y.Z. The bridge image is just the kne binary, so it
# carries KNE's version rather than one of its own.
TAG := $(shell git describe --tags --abbrev=0 --match='v*' 2>/dev/null || echo latest)
include .mk/kind.mk
include .mk/lint.mk
include .mk/ocipush.mk
.PHONY: all
all: docker
.PHONY: docker
## Build all docker images
docker: meshnet-docker bridge-docker
## Run unit tests
## Ignore all tests under the cloudbuild/ tree as these targets are end-to-end
test:
go test -race `go list ./... | grep -v /cloudbuild`
## Targets below are for integration testing only
.PHONY: up
## Build test environment
up: kind-start
.PHONY: down
## Destroy test environment
down: kind-stop
.PHONY: build
## Build kne
build:
CGO_ENABLED=0 go build -o $(KNE_CLI_BIN) -ldflags="-s -w" kne_cli/main.go
.PHONY: install
## Install kne cli binary to user's local bin dir
install: build
sudo mv $(KNE_CLI_BIN) $(INSTALL_DIR)
.PHONY: bridge-docker
## Build bridge docker image
bridge-docker:
docker build \
-t $(BRIDGE_DOCKER_IMAGE):$(TAG) \
-t $(BRIDGE_DOCKER_IMAGE):ga \
-f deploy/bridge/Dockerfile .
.PHONY: kind-load-bridge
## Load bridge docker image into kind cluster
kind-load-bridge:
kind load docker-image --name $(KIND_CLUSTER_NAME) $(BRIDGE_DOCKER_IMAGE):ga
.PHONY: bridge-release
## Release bridge docker image
bridge-release:
docker push $(BRIDGE_DOCKER_IMAGE):$(TAG)
docker push $(BRIDGE_DOCKER_IMAGE):ga
.PHONY: meshnet-docker
## Build meshnet docker image
meshnet-docker:
$(MAKE) -C third_party/meshnet docker DOCKER_IMAGE=$(MESHNET_DOCKER_IMAGE)
.PHONY: meshnet-release
## Release meshnet docker image
meshnet-release:
$(MAKE) -C third_party/meshnet release DOCKER_IMAGE=$(MESHNET_DOCKER_IMAGE)