11current_dir =$(shell pwd)
2- version =$( shell bash ./build/version.sh)
2+ version =${PLUGIN_VERSION}
33date =$(shell date +% Y% m% d% H% M% S)
4- project_name = $(shell basename "${current_dir}")
4+ project_name ?= $(shell basename "${current_dir}")
55remote_docker_image_registry =ccr.ccs.tencentyun.com/webankpartners/wecube-plugins-artifacts
6- with_nexus ='true'
6+ arch ?= amd64 # 默认amd64,可选 ARCH=amd64/arm64
7+ with_nexus ?= true # 默认true,可选 WITH_NEXUS=true/false
8+ ifeq ($(with_nexus ) ,true)
9+ dockerfile := Dockerfile
10+ else
11+ dockerfile := Dockerfile_nonexus
12+ endif
713
8- clean_py :
9- rm -rf $(current_dir ) /artifacts-corepy/dist/
1014
11- build_py : clean_py
15+
16+ clean :
17+ rm -rf package
18+ rm -rf artifacts-corepy/dist/
19+ rm -rf artifacts-ui/dist/
20+
21+ build : clean
1222 pip3 install wheel
1323 cd artifacts-corepy && python3 setup.py bdist_wheel
14- cd artifacts-ui && npm install --force && npm run plugin
24+ docker run --rm -v $( current_dir ) :/home/node/app -w /home/node/app node:16.20.2 sh -c " npm set registry https://mirrors.cloud.tencent.com/npm/ && cd /home/node/app/ artifacts-ui && npm install --force && npm run plugin"
1525
16- image_py : build_py
26+ image : build
27+ ifeq ($(with_nexus ) ,true)
1728 wget -O nexus-data.tar.gz https://wecube-1259801214.cos.ap-guangzhou.myqcloud.com/nexus-data/nexus-data.tar.gz
18- @if [ $( with_nexus ) == ' true ' ] ; \
19- then \
20- docker build -t $(project_name ) :$(version ) . ; \
21- else \
22- docker build -t $(project_name ) :$(version ) -f Dockerfile_nonexus . ; \
23- fi
29+ endif
30+ ifeq ( $( arch ) ,arm64)
31+ docker buildx build --platform linux/arm64 - t $(project_name):$(version) -f $(dockerfile) . --load
32+ else
33+ docker build -t $(project_name):$(version) -f $(dockerfile) .
34+ endif
2435
25- package_py : image_py
36+ package : image
2637 rm -rf package
2738 mkdir -p package
2839 cd package && docker save $(project_name ) :$(version ) -o image.tar
@@ -32,13 +43,13 @@ package_py: image_py
3243 cd package && sed -i " s~{{VERSION}}~$( version) ~g" register.xml
3344 cd artifacts-ui/dist && zip -r ui.zip .
3445 cd package && cp ../artifacts-ui/dist/ui.zip .
35- cd package && zip -r $(project_name ) -$(version ) .zip .
46+ cd package && zip -r $(project_name ) -$(version ) - $( arch ) .zip .
3647 docker rmi $(project_name ) :$(version )
3748
38- upload_py : package_py
49+ upload : package
3950 $(eval container_id:=$(shell docker run -v $(current_dir ) /package:/package -itd --entrypoint=/bin/sh minio/mc) )
4051 docker exec $(container_id ) mc config host add wecubeS3 $(s3_server_url ) $(s3_access_key ) $(s3_secret_key ) wecubeS3
41- docker exec $(container_id ) mc cp /package/$(project_name ) -$(version ) .zip wecubeS3/wecube-plugin-package-bucket
52+ docker exec $(container_id ) mc cp /package/$(project_name ) -$(version ) - $( arch ) .zip wecubeS3/wecube-plugin-package-bucket
4253 docker stop $(container_id )
4354 docker rm -f $(container_id )
44- rm -rf $(project_name ) -$(version ) .zip
55+ rm -rf $(project_name ) -$(version ) - $( arch ) .zip
0 commit comments