-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
43 lines (38 loc) · 1.75 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
current_dir=$(shell pwd)
project_name=$(shell basename "${current_dir}")
version=${PLUGIN_VERSION}
clean:
rm -rf api/wecubek8s/dist/
build: clean
cd api/wecubek8s && pip3 install wheel
cd api/wecubek8s && python3 setup.py bdist_wheel
# cd ui && npm --registry https://registry.npm.taobao.org install --unsafe-perm
# cd ui && npm rebuild node-sass
# cd ui && npm run plugin
image: build
docker build -t $(project_name):$(version) .
package: image
rm -rf package
mkdir -p package
echo "$(version)" > api/wecubek8s/VERSION
cd package && sed 's/{{PLUGIN_VERSION}}/$(version)/' ../build/register.xml.tpl > ./register.xml
cd package && sed -i 's/{{IMAGENAME}}/$(project_name):$(version)/g' ./register.xml
cd package && sed -i 's/{{CONTAINERNAME}}/$(project_name)-$(version)/g' ./register.xml
cd package && docker save -o image.tar $(project_name):$(version)
# cd ui/dist && zip -9 -r ui.zip .
# cd package && mv ../ui/dist/ui.zip .
cd package && cp ../init.sql ./init.sql
# cd package && zip -9 $(project_name)-$(version).zip image.tar register.xml init.sql ui.zip
cd package && zip -9 $(project_name)-$(version).zip image.tar register.xml init.sql
cd package && rm -f image.tar
cd package && rm -f register.xml
# cd package && rm -f ui.zip
cd package && rm -f init.sql
docker rmi $(project_name):$(version)
upload: package
$(eval container_id:=$(shell docker run -v $(current_dir)/package:/package -itd --entrypoint=/bin/sh minio/mc))
docker exec $(container_id) mc config host add wecubeS3 $(s3_server_url) $(s3_access_key) $(s3_secret_key) wecubeS3
docker exec $(container_id) mc cp /package/$(project_name)-$(version).zip wecubeS3/wecube-plugin-package-bucket
docker stop $(container_id)
docker rm -f $(container_id)
rm -rf $(project_name)-$(version).zip