-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
118 lines (93 loc) · 3.83 KB
/
Copy pathMakefile
File metadata and controls
118 lines (93 loc) · 3.83 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
TARGET=kubeshare-scheduler kubeshare-device-manager kubeshare-config-client
GO=go
GO_MODULE=GO111MODULE=on
BIN_DIR=bin/
ALPINE_COMPILE_FLAGS=CGO_ENABLED=0 GOOS=linux GOARCH=amd64
NVML_COMPILE_FLAGS=CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-object-files' GOOS=linux GOARCH=amd64
PACKAGE_PREFIX=github.com/Interstellarss/faas-share/cmd/
.PHONY: build local push namespaces install charts start-kind stop-kind build-buildx render-charts all clean $(TARGET)
IMG_NAME?=faas-share
TAG?=v0.1.20
OWNER?=interstellarss
SERVER?=ghcr.io
export DOCKER_CLI_EXPERIMENTAL=enabled
export DOCKER_BUILDKIT=1
TOOLS_DIR := .tools
GOPATH := $(shell go env GOPATH)
CODEGEN_VERSION := $(shell hack/print-codegen-version.sh)
CODEGEN_PKG := $(GOPATH)/pkg/mod/k8s.io/code-generator@${CODEGEN_VERSION}
VERSION := $(shell git describe --tags --dirty)
GIT_COMMIT := $(shell git rev-parse HEAD)
all: build-docker $(TARGET)
$(TOOLS_DIR)/code-generator.mod: go.mod
@echo "syncing code-generator tooling version"
@cd $(TOOLS_DIR) && go mod edit -require "k8s.io/code-generator@${CODEGEN_VERSION}"
${CODEGEN_PKG}: $(TOOLS_DIR)/code-generator.mod
@echo "(re)installing k8s.io/code-generator-${CODEGEN_VERSION}"
@cd $(TOOLS_DIR) && go mod download -modfile=code-generator.mod
local:
CGO_ENABLED=0 go build -a -installsuffix cgo -o faas-share
build-docker:
docker build \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg VERSION=$(VERSION) \
-t $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG) .
.PHONY: build-buildx
build-buildx:
@echo $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG) && \
docker buildx create --use --name=multiarch --node=multiarch && \
docker buildx build \
--push \
--platform linux/amd64 \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg VERSION=$(VERSION) \
--tag $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG) \
.
.PHONY: build-buildx-all
build-buildx-all:
@docker buildx create --use --name=multiarch --node=multiarch && \
docker buildx build \
--platform linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=false" \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg VERSION=$(VERSION) \
--tag $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG) \
.
.PHONY: publish-buildx-all
publish-buildx-all:
@echo $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG) && \
docker buildx create --use --name=multiarch --node=multiarch && \
docker buildx build \
--platform linux/amd64,linux/arm/v7,linux/arm64 \
--push=true \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg VERSION=$(VERSION) \
--tag $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG) \
.
push:
docker push $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG)
charts:
cd chart && helm package faas-share/ && helm package kafka-connector/ && helm package cron-connector/ && helm package nats-connector/ && helm package mqtt-connector/ && helm package pro-builder/ && helm package sqs-connector/
mv chart/*.tgz docs/
helm repo index docs --url https://interstellarss.github.io/faas-share --merge ./docs/index.yaml
./contrib/create-static-manifest.sh
render-charts:
./contrib/create-static-manifest.sh
./contrib/create-static-manifest.sh ./chart/faas-share ./yaml_arm64 ./chart/faas-share/values-arm64.yaml
./contrib/create-static-manifest.sh ./chart/faas-share ./yaml_armhf ./chart/faas-share/values-armhf.yaml
start-kind: ## attempt to start a new dev environment
@./contrib/create_dev.sh
stop-kind: ## attempt to stop the dev environment
@./contrib/stop_dev.sh
.PHONY: verify-codegen
verify-codegen: ${CODEGEN_PKG}
./hack/verify-codegen.sh
.PHONY: update-codegen
update-codegen: ${CODEGEN_PKG}
./hack/update-codegen.sh
kubeshare-device-manager kubeshare-scheduler:
$(GO_MODULE) $(ALPINE_COMPILE_FLAGS) $(GO) build -o $(BIN_DIR)$@ $(PACKAGE_PREFIX)$@
kubeshare-config-client:
$(GO_MODULE) $(NVML_COMPILE_FLAGS) $(GO) build -o $(BIN_DIR)$@ $(PACKAGE_PREFIX)$@
clean:
rm $(BIN_DIR)* 2>/dev/null; exit 0