net core k8s jenkins 前后端自动部署shell备份

---dev-backend-microweb

 

echo ${BUILD_VERSION} 
echo ${WORKSPACE}
readonly SRC="/src/Services/IdentityService/IdentityApi/"
readonly IMAGE_ID="10.206.0.11:5100/"
readonly PROJECTNAME="microweb/dev"
readonly PROJECTDEPLOY="dev-backend-microweb-deployment.yaml"
cd  ${WORKSPACE}
rm  -rf  publish
mkdir publish
cd publish


cd ${WORKSPACE}/publish/
rm  -rf  *
cd  ${WORKSPACE}${SRC}
dotnet publish IdentityApi.csproj -c release -f netcoreapp3.1 -r linux-x64  --self-contained false -o ${WORKSPACE}/publish

cd ${WORKSPACE}/publish/

docker build  -t  ${IMAGE_ID}${JOB_NAME}:${BUILD_VERSION} .

docker push ${IMAGE_ID}${JOB_NAME}:${BUILD_VERSION}

docker rmi ${IMAGE_ID}${JOB_NAME}:${BUILD_VERSION} -f
cd Deploy/${PROJECTNAME}
sed -i "s#xxxx-xxxx:xx#${IMAGE_ID}${JOB_NAME}:${BUILD_VERSION}#g" ${PROJECTDEPLOY}
kubectl apply -f ./

 

---dev-front-microweb

node -v
echo ${BUILD_VERSION} 
echo ${WORKSPACE}
readonly IMAGE_ID="10.206.0.11:5100/"
readonly PROJECTPATH="microweb/dev"
readonly PROJECTDEPLOY="dev-front-microweb-deployment.yaml"
readonly VUECONFIG="vue.config.js"
readonly PROJECTNAME="dev-front-microweb"
cd  ${WORKSPACE}
sed -i "s#xxxx-xxxx:xx#${PROJECTNAME}#g" ${VUECONFIG}
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install
cnpm run build
cd dist
docker build  -t  ${IMAGE_ID}${JOB_NAME}:${BUILD_VERSION} .
docker push ${IMAGE_ID}${JOB_NAME}:${BUILD_VERSION}
docker rmi ${IMAGE_ID}${JOB_NAME}:${BUILD_VERSION} -f
cd deploy/${PROJECTPATH}
sed -i "s#xxxx-xxxx:xx#${IMAGE_ID}${JOB_NAME}:${BUILD_VERSION}#g" ${PROJECTDEPLOY}
kubectl apply -f ./

  

net core k8s jenkins 前后端自动部署shell备份

上一篇:浅谈PHP进程管理


下一篇:在kubernetes集群里集成Apollo配置中心(5)之dubbo服务消费者连接apollo实战