devops工具链, 基于docker register仓库, docker portainer容器管理

发布时间2018/9/7 13:53:04

下载次数 0 次 访问量890 次

免开发-应用中心上线啦,专注提供优质插件源码和产品应用!

jenkins-cicd

devops工具链, 基于docker register仓库, docker portainer容器管理

架构如下

feature

dependences

Quick-Start

samples

projectPath="src/PushSrv/FM.Push.Srv/" projectName="FM.Push.Srv.csproj" dockerImgName="cs-push-grpc-srv" dockerfile="./dockerfile/service_dockerfile" ##依赖于CHANAGELOG 来标识docker/gittag tag=`head -1 CHANGELOG` dotnet publish -o out  -c Release "$projectPath""$projectName" mv "$projectPath"out/* out/application

cp $dockerfile ./out/application/Dockerfile cd out/application
local_docker_image_name=$(printf '%s:%s' $dockerImgName $tag) function GetParameterValue() { #$1  env :dev/beta/prod  #$2  _docker_username  ename=$1$2 value=$(eval "echo \"\$$ename\"") echo $value }                                           
dockerhubgroup=$(GetParameterValue $env "_dockerhub_group") dockerhuburl=$(GetParameterValue $env "_docker_hub_url") dockerhubuser=$(GetParameterValue $env "_docker_username") dockerhubpass=$(GetParameterValue $env "_docker_password") dockerhubdomain=$(GetParameterValue $env "_dockerhub_domain") docker build -t $local_docker_image_name . full_docker_image_name=$(printf '%s/%s/%s:%s' $dockerhubdomain $dockerhubgroup $dockerImgName $tag) echo 'push to register' docker login -u $dockerhubuser -p $dockerhubpass $dockerhuburl docker tag $local_docker_image_name $full_docker_image_name docker push $full_docker_image_name if [ "$env" = "dev" ]; then python /root/pubtool/main.py --deploy_env=dev --docker_env="ASPNETCORE_ENVIRONMENT=Development" --docker_env='ASPNETCORE_ENDPOINT=192.168.8.11' --node=1 --container_name="$dockerImgName" --docker_image="$local_docker_image_name" elif [ "$env" = "beta" ]; then echo "publish to beta" python /root/pubtool/main.py --docker_env='ASPNETCORE_ENVIRONMENT=Staging' --deploy_env=beta  --node=2 --container_name="$dockerImgName" --docker_image="$local_docker_image_name" elif [ "$env" = "prod" ]; then echo "publish to prod" python /root/pubtool/main.py --docker_env='ASPNETCORE_ENVIRONMENT=Production' --deploy_env=prod  --node=7 --container_name="$dockerImgName" --docker_image="$local_docker_image_name" else echo "unknow" exit 1 fi 

https://github.com/FollowmeTech/jenkins-cicd

网友评论

发表评论

欢迎评论哦!