forked from karmada-io/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
58 lines (50 loc) · 1.51 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
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
VERSION ?= $(shell hack/version.sh)
# Images management
REGISTRY ?= "docker.io/karmada"
REGISTRY_USER_NAME ?= ""
REGISTRY_PASSWORD ?= ""
REGISTRY_SERVER_ADDRESS ?= ""
TARGETS := karmada-dashboard-api \
karmada-dashboard-web \
# Build binary.
#
# Args:
# GOOS: OS to build.
# GOARCH: Arch to build.
#
# Example:
# make
# make all
# make karmada-dashboard-api GOOS=linux
.PHONY: $(TARGETS)
$(TARGETS):
BUILD_PLATFORMS=$(GOOS)/$(GOARCH) hack/build.sh $@
.PHONY: all
all: $(TARGETS)
# Build image.
#
# Args:
# GOARCH: Arch to build.
# OUTPUT_TYPE: Destination to save image(docker/registry).
#
# Example:
# make images
# make image-karmada-dashboard-api
# make image-karmada-dashboard-api GOARCH=arm64
IMAGE_TARGET=$(addprefix image-, $(TARGETS))
.PHONY: $(IMAGE_TARGET)
$(IMAGE_TARGET):
set -e;\
target=$$(echo $(subst image-,,$@));\
make $$target GOOS=linux;\
VERSION=$(VERSION) REGISTRY=$(REGISTRY) BUILD_PLATFORMS=linux/$(GOARCH) hack/docker.sh $$target
bundle-ui-dashboard:
cd ui && pnpm run dashboard:build
bin-karmada-dashboard-web:
BUILD_PLATFORMS=$(GOOS)/$(GOARCH) hack/build.sh karmada-dashboard-web
image-karmada-dashboard-web:
BUILD_PLATFORMS=linux/$(GOARCH) hack/build.sh karmada-dashboard-web
cp -R ui/apps/dashboard/dist _output/bin/linux/$(GOARCH)/dist
DOCKER_FILE="build-web.Dockerfile" VERSION=$(VERSION) REGISTRY=$(REGISTRY) BUILD_PLATFORMS=linux/$(GOARCH) hack/docker.sh karmada-dashboard-web