1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- PROJECT:=config-center-server
- .PHONY: build
- VERSION_FILE:=./VERSION
- VERSION = $(shell cat ${VERSION_FILE})
- GO_LIB_VERSION = $(shell grep 'git.cestong.com.cn/cecf/cecf-golib v' go.mod | cut -d' ' -f2)
- HX_VERSION = $(shell grep 'git.cestong.com.cn/cecf/config-center-server v' go.mod | cut -d' ' -f2)
- BIN_PATH=./bin/config-center-server
- updateGoLibVersion:
- sed -i.bak "s/goLibVersion\s*=\s*\".*\"/goLibVersion=\"${GO_LIB_VERSION}\"/g" ./version.go
- rm -f ./version.go.bak
- updateVersion:
- sed -i.bak "s/version\s*=\s*\".*\"/version=\"${VERSION}\"/g" ./version.go
- rm -f ./version.go.bak
- updateVersions: updateGoLibVersion updateVersion
- echo ${VERSION}
- build: updateVersions
- go mod tidy
- CGO_ENABLED=0 go build -o ${BIN_PATH}
- build-prod: updateVersion updateGoLibVersion
- go mod tidy
- CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o ${BIN_PATH}
- run-cest-2: build
- ssh cest-2 'cd config-center-server && ./stop.sh'
- scp bin/config-center-server cest-2:~/config-center-server/bin/
- ssh cest-2 'cd config-center-server && ./start.sh'
- run: build
- ${BIN_PATH} server -c config/settings.yml
- db-dump:
- mysqldump -u root -h 127.0.0.1 -p hx > db-bak.sql
- DOCKER_IMAGE_NAME=config-center-server
- DOCKER_REMOTE_IMAGE_NAME=registry.cestong.com:8150/cecf/${DOCKER_IMAGE_NAME}
- docker-build:
- docker build . -f Dockerfile -t ${DOCKER_IMAGE_NAME}
- docker-push: docker-build
- docker tag ${DOCKER_IMAGE_NAME} ${DOCKER_REMOTE_IMAGE_NAME}
- docker push ${DOCKER_REMOTE_IMAGE_NAME}
- deploy-test: docker-push
- ssh cest-2 'cd hx-admin-server && docker-compose pull && docker-compose up -d'
- release-tag:
- git tag "v${VERSION}"
- git push --tags
|