forked from labring/sealos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (65 loc) · 2.34 KB
/
Copy pathMakefile
File metadata and controls
73 lines (65 loc) · 2.34 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
DOCKER_USERNAME := $(DOCKER_USERNAME)
IMAGE_TAG := $(IMAGE_TAG)
ifneq ($(strip $(DOCKER_USERNAME)),)
imageOwner := $(DOCKER_USERNAME)/
else
imageOwner :=
endif
ifneq ($(strip $(IMAGE_TAG)),)
imageTag := $(IMAGE_TAG)
else
imageTag := dev
endif
# build image
buildTargets := \
desktop \
providers/terminal \
providers/costcenter \
providers/dbprovider \
providers/applaunchpad \
providers/cloudserver \
providers/invite \
providers/imagehub \
providers/template \
providers/cronjob \
providers/license \
providers/kubepanel \
providers/objectstorage
buildTargets-all := $(addprefix image-build-,$(buildTargets))
pushTargets-all := $(addprefix image-push-,$(buildTargets))
$(foreach target,$(buildTargets),$(eval .PHONY: image-build-$($(target))))
$(foreach target,$(buildTargets),$(eval .PHONY: image-push-$($(target))))
$(foreach target,$(buildTargets),$(eval .PHONY: dev-$($(target))))
$(foreach target,$(buildTargets),$(eval .PHONY: build-$($(target))))
.PHONY: all image-prebuild push-images
all: image-prebuild $(buildTargets-all)
push-images: image-prebuild $(pushTargets-all)
fetch-deps: pnpm-lock.yaml
pnpm fetch
build-packages: fetch-deps
pnpm -r --offline --filter=./packages/* install
pnpm -r --offline --filter=./packages/* build
build-providers/%: build-packages
pnpm -r --offline --filter=./providers/$* install
pnpm -r --offline --filter=./providers/$* build
build-%: build-packages
pnpm -r --offline --filter=$* install
pnpm -r --offline --filter=$* build
dev-providers/%: build-packages
pnpm -r --offline --filter=./providers/$* install
pnpm -r --offline --filter=./providers/$* dev
dev-%: build-packages
pnpm -r --offline --filter=$* install
pnpm -r --offline --filter=$* dev
# prebuild-image-for -j
image-prebuild: pnpm-lock.yaml
docker build --platform=linux/amd64 --target deps . -t $(imageOwner)sealos-deps:dev
image-build-providers/%: image-prebuild
docker build --platform=linux/amd64 -t $(imageOwner)sealos-$*:$(imageTag) --build-arg path=providers/$* --build-arg name=$* .
image-build-%: image-prebuild
docker build --platform=linux/amd64 -t $(imageOwner)sealos-$*:$(imageTag) --build-arg path=$* --build-arg name=$* .
image-push-providers/%: image-build-providers/%
docker push $(imageOwner)sealos-$*:$(imageTag)
image-push-%: image-build-%
docker push $(imageOwner)sealos-$*:$(imageTag)
# Default target to run all builds.