1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- PROJECT:=go-admin
- .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/hx-mobile-server-api v' go.mod | cut -d' ' -f2)
- updateGoLibVersion:
- sed -i.bak "s/goLibVersion\s*=\s*\".*\"/goLibVersion=\"${GO_LIB_VERSION}\"/g" ./version.go
- rm -f ./version.go.bak
- updateHXLibVersion:
- sed -i.bak "s/hxVersion\s*=\s*\".*\"/hxVersion=\"${HX_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 updateHXLibVersion updateVersion
- echo ${VERSION}
- build: updateVersions
- go mod tidy
- CGO_ENABLED=0 go build -o bin/hx-admin-server .
- build-prod: updateVersion updateGoLibVersion updateHXLibVersion
- go mod tidy
- CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o bin/hx-admin-server .
- run: build
- ./bin/hx-admin-server server -c config/settings.yml
- v0-update:
- cp -rf backend-v0/app/* /home/yawyd/containers/hx-v0/container/html/ctc/app/
- sudo chown -R www-data:www-data /home/yawyd/containers/hx-v0/container/html/ctc/app/
- docker restart ctc-php
- db-dump:
- mysqldump -u root -h 127.0.0.1 -p hx > db-bak.sql
- DOCKER_IMAGE_NAME=hx-admin-server
- DOCKER_REMOTE_IMAGE_NAME=registry.cestong.com:8150/zhixueyun/${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
|