-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (37 loc) · 1.81 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
current_dir=$(shell pwd)
version=$(shell bash ./build/version.sh)
date=$(shell date +%Y%m%d%H%M%S)
project_name=$(shell basename "${current_dir}")
remote_docker_image_registry=ccr.ccs.tencentyun.com/webankpartners/wecube-plugins-wecmdb
clean:
rm -rf $(current_dir)/target
.PHONY:build
build: clean
mkdir -p repository
docker run --rm --name wecube-plugins-wecmdb-build -v /data/repository:/usr/src/mymaven/repository -v $(current_dir)/build/maven_settings.xml:/usr/share/maven/ref/settings-docker.xml -v $(current_dir):/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-8 mvn -U clean install -Dmaven.test.skip=true -s /usr/share/maven/ref/settings-docker.xml dependency:resolve
image: build
docker build -t $(project_name):$(version) .
s3_server_url=http://10.10.10.1:9000
s3_access_key=access_key
s3_secret_key=secret_key
branch_name=master
.PHONY:package
package: image
rm -rf package
mkdir -p package
cd package && docker save $(project_name):$(version) -o image.tar
cd package && cp ../register.xml .
cd package && sed -i "s~{{REPOSITORY}}~$(project_name)~g" register.xml
cd package && sed -i "s~{{VERSION}}~$(version)~g" register.xml
cd we-cmdb && git checkout $(branch_name) && git pull
cd we-cmdb && make build-plugin-ui
cd we-cmdb/cmdb-ui/dist && zip -r ui.zip .
cd package && cp ../we-cmdb/cmdb-ui/dist/ui.zip .
cd package && zip -r $(project_name)-$(version).zip .
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)