VSTS + XX云服务器构建netcore+docker持续集成交付部署
先贴一张图
持续集成(Continuous Integration)
持续交付(Continuous Delivery)
持续部署(Continuous Deployment)
更多概念请参
持续集成交付部署是什么意思,它给我们带来什么好处? 先贴一张图 持续集成(Continuous Integration) 持续交付(Continuous Delivery) 持续部署(Continuous Deployment) 更多概念请参考%3A//www.mindtheproduct.com/2016/02/what-the-hell-are-ci-cd-and-devops-a-cheatsheet-for-the-rest-of-us/ 减少重复劳动 提高效率 jenkins大家都知道吧,但今天我们用微软的vsts来定制个性化定制持续集成交付(个人或者小团队我建议用vsts 也不用自己安装jenkins环境了 直接用vsts在线系统很方便) 用到的资源有: 腾讯云服务器ubuntu一台(自己先安装好docker哈) vsts创建一个git(有微软账号就能免费创建,> site/drop/Dockerfile echo命令是往创建的dockerfile里面写入内容 echo "COPY . /publish" >> site/drop/Dockerfile echo "WORKDIR /publish" >> site/drop/Dockerfile echo "EXPOSE 5001" >> site/drop/Dockerfile echo "CMD [\"dotnet\", \"TestDotnetcore.dll\"]" >> site/drop/Dockerfile sudo docker build --rm -t test_image -f site/drop/Dockerfile site/drop/ 创建一个image 名字叫 test_image sudo docker ps -q --filter "name=test_netcore" | grep -q . && sudo docker rm -f test_netcore || true 查看是否有没有叫 test_netcore的容器有没有在runing 如果有就干掉它 sudo docker run --name test_netcore -d -p 5001:5001 test_image:latest 根据test_image启动一个名字叫test_netcore的容器 if sudo docker images -f "dangling=true" | grep ago --quiet; then sudo docker rmi -f $(sudo docker images -f "dangling=true" -q); fi 查看是否有的image 把它删掉 因为我们创建image的时候每次都会覆盖所以会产生一些没有的image sudo rm -rf site/drop 都ok了就删掉drop目录 以上一切准备好 提交一个commit到master试试 会自动触发CI 进行 编译 发布 接下来Release发布 发布打包的成果物在这里查看 发布成功 查看下docker image 已经成功创建了test_image这个镜像 容器是也跑成功了 验证一下 完美!!!不管你用的是腾讯云还是阿里云还是其他云都是可以的! 遗留问题: TestDotnetcore.zip是我查看发布的日志找到的这个名字目前我还没有找到变量可以代替 有谁知道帮忙教育下! (编辑:通辽站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |