.PHONY: version #ifeq ($(wildcard ./version),) # # 如果version文件不存在,设置一个默认值或者不做任何操作 # version?=1.0.0 #else # version:=$(shell cat ./version) #endif #major:=$(echo $(version) | cut -d. -f1) #minor:=$(echo $(version) | cut -d. -f2) #patch:=$(echo $(version) | cut -d. -f3 | sed 's/^v//') #new_patch:=$((patch + 1)) #new_version:="$(major).$(minor).$(new_patch)" version?=1.0.0 tag=reg.cestong.com.cn/cecf/ob-agent-stream:${version} release_tag=hub.js.sgcc.com.cn/observe/ob-agent-stream:${version} save_dir=~/tmp next_version: echo $(version) echo $(major) echo $(minor) echo $(patch) echo $(new_version) jar: mvn package docker-build: jar docker build . -t ${tag} docker-push: docker-build docker push ${tag} echo ${version} > ./version release: docker tag ${tag} ${release_tag} docker save ${release_tag} -o ${save_dir}/ob-agent-stream_${version}.tar # test js_test_tag=hub.js.sgcc.com.cn/observe/ob-agent-stream:${version} js_test_save_path=~/tmp/oas-js-test-${version}.tar js-test-docker-build: jar docker build . -t ${js_test_tag} docker save ${js_test_tag} -o ${js_test_save_path} js-test-docker-push: js-test-docker-build docker push ${js_test_tag} echo ${version} > ./version # js prod js_prod_tag=hub.js.sgcc.com.cn/observe/ob-agent-stream:${version} js_test_save_path=~/tmp/oas-js-prod-${version}.tar js-prod-docker-build: jar docker build . -t ${js_prod_tag} docker save ${js_prod_tag} -o ${js_test_save_path}