WORK_PATH=/Users/xudehong/go/src/gitlab.com/jwes
Version=v1.0.21
build-server-auth:
cp ${WORK_PATH}/dev.ini services/auth
cp -r ${WORK_PATH}/crt services/auth
cd services/auth && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_auth .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_auth:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_auth:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-boke:
cp ${WORK_PATH}/dev.ini services/boke
cd services/boke && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_boke .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_boke:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_boke:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-file:
cp ${WORK_PATH}/dev.ini services/file
cd services/file && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_file .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_file:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_file:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-msg:
cp ${WORK_PATH}/dev.ini services/msg
cd services/msg && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_msg .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_msg:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_msg:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-commercial:
cp ${WORK_PATH}/dev.ini services/resources
cp -r ${WORK_PATH}/crt services/resources
cd services/resources && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_commercial .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_commercial:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_commercial:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-utils:
cp ${WORK_PATH}/dev.ini services/utils
cd services/utils && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_utils .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_utils:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_utils:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-ad:
cp ${WORK_PATH}/dev.ini services/ad
cd services/ad && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_ad .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_ad:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_ad:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-ws-auction:
cp ${WORK_PATH}/dev.ini apis/msg
cd apis/msg && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_ws_auction .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_ws_auction:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_ws_auction:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-company:
cp ${WORK_PATH}/dev.ini services/company
cd services/company && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_company .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_company:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_company:${Version}; \
cd ${WORK_PATH} || exit 0
build-api-auth:
cp ${WORK_PATH}/dev.ini apis/auth
cd apis/auth && env CGO_ENABLED=0 GOOS=linux go build -o jwes_api_auth .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_api_auth:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_api_auth:${Version}; \
cd ${WORK_PATH} || exit 0
build-api-files:
cp ${WORK_PATH}/dev.ini apis/files
cd apis/files && env CGO_ENABLED=0 GOOS=linux go build -o jwes_api_files .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_api_files:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_api_files:${Version}; \
cd ${WORK_PATH} || exit 0
build-api-commercial:
cp ${WORK_PATH}/dev.ini apis/commercial
cd apis/commercial && env CGO_ENABLED=0 GOOS=linux go build -o jwes_api_commercial .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_api_commercial:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_api_commercial:${Version}; \
cd ${WORK_PATH} || exit 0
build-api-ad:
cp ${WORK_PATH}/dev.ini apis/ad
cd apis/ad && env CGO_ENABLED=0 GOOS=linux go build -o jwes_api_ad .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_api_ad:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_api_ad:${Version}; \
cd ${WORK_PATH} || exit 0
build-api-order:
cd deploy/java || exit 0; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_java_api_order:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_java_api_order:${Version}; \
cd ${WORK_PATH} || exit 0
build-api-admin:
cd deploy/java-admin || exit 0; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_java_admin:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_java_admin:${Version}; \
cd ${WORK_PATH} || exit 0
build-server-auction:
cp ${WORK_PATH}/dev.ini services/auction
cd services/auction && env CGO_ENABLED=0 GOOS=linux go build -o jwes_server_auction .; \
docker build -t registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_auction:${Version} .; \
docker push registry.cn-hangzhou.aliyuncs.com/xugopher/jwes_server_auction:${Version}; \
cd ${WORK_PATH} || exit 0
# 替换掉版本信息拷贝给服务器 在服务器上进行更新
update-version:
sed -E -i '' 's/v[0-9]+.[0-9]+.[0-9]+/${Version}/g' ${WORK_PATH}/docker-compose.yaml
sed -E -i '' 's/v[0-9]+.[0-9]+.[0-9]+/${Version}/g' /Users/xudehong/Desktop/jwes-k8s/deploy/develop/app/java.yaml
sed -E -i '' 's/v[0-9]+.[0-9]+.[0-9]+/${Version}/g' /Users/xudehong/Desktop/jwes-k8s/deploy/develop/app/k8s.yaml
sed -E -i '' 's/v[0-9]+.[0-9]+.[0-9]+/${Version}/g' /Users/xudehong/Desktop/jwes-k8s/deploy/pro/k8s.yaml
sed -E -i '' 's/v[0-9]+.[0-9]+.[0-9]+/${Version}/g' /Users/xudehong/Desktop/jwes-k8s/deploy/pro/java.yaml
scp -r /Users/xudehong/Desktop/jwes-k8s/deploy/develop/app [email protected]:/home/jwes/deploy/develop
scp -r /Users/xudehong/Desktop/jwes-k8s/deploy/pro [email protected]:/root/
update-kubernetes:
ssh -i ~/.ssh/id_rsa [email protected] 'cd deploy/develop/app/; \
kubectl apply -f k8s.yaml; \
kubectl apply -f java.yaml; \
kubectl get pods -n develop -o wide'
echo "测试环境接口 服务部署完了"
all: build-server-auth build-server-boke build-server-file build-server-msg \
build-server-commercial build-server-utils build-server-ad build-server-ws-auction \
build-server-company build-api-auth build-api-files build-api-commercial \
build-api-ad build-api-order build-api-admin build-server-auction \
update-version update-kubernetes
指令:
make all && docker-compose down && docker-compose up -d