1、前言与初衷
- 本文章会涉及Docker常见命令基础知识点结合不同场景实操一起使用。
- 本文章会涉及结合工作过程中部署不同环境服务器的项目案例场景为初心进行实际细讲。
- 本文章主要讲述Docker、Jenkins、GitLab、Git、JDK、SpringBoot、Maven等技术结合实现自动化运维部署(DevOps)应用工程,适合SpringCloud部署。
- 初衷想法:在学习过程中遇到比较有趣的问题、然而花了点心血和时间去整理,然而进行梳理出来一份文章比较完整有知识体系的DevOps自动化构建与部署工程文章,技术知识内容比较多,而且文章内容较长,然而分了几个章程来讲述
2、什么是DevOps?
- DevOps(Development和Operations的组合词)是一组过程、方法与系统的统称,用于促进开发(应用程序/软件工程)、技术运营和质量保障(QA)部门之间的沟通、协作与整合,它是一种重视“软件开发人员(Dev)”和“IT运维技术人员(Ops)”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程,来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。
- 它的出现是由于软件行业日益清晰地认识到:为了按时交付软件产品和服务,开发和运营工作必须紧密合作。
3 涉及软件环境搭建内容
- 3.1 如何在Centos7安装JDK1.8-u121详解 https://www.jianshu.com/p/dfaaedeb6817
- 3.2 如何在Centos7安装Maven3.6.1详解 https://www.jianshu.com/p/299eeef785f0
- 3.3 如何在Centos7安装Git详解 https://www.jianshu.com/p/a22577232977
- 3.4 如何在CentOS7与Git配置免密码登陆详解 https://www.jianshu.com/p/e4946edce9a4
- 3.5 如何在Docker安装GitLab详解 https://www.jianshu.com/p/0bc9b4755082
- 3.6 如何在Docker创建NetWork网络详解 https://www.jianshu.com/p/9784d63eff23
- 3.7 如何在Docker安装Registry私服详解 https://www.jianshu.com/p/7827e40aaa71
- 3.8 如何在Docker安装Jenkins详解 https://www.jianshu.com/p/72d05e43a8f3
特别说明
特别说明
1、如何使用Maven结合Docker把SpringBoot应用编译成可用的镜像进行部署。
2、其中JDK和Maven是传统方式进行安装,由于本人Centos操作系统是有其他软件依赖它们,有时候传统方式安装软件会更好,这里不过多的阐述。有些软件在Docker安装过程与使用过程并没传统方式的简单,比如:Jenkins。
【CentOS-7-x86_64-Minimal-1810.iso下载地址】 http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
4、需要准备的工作有哪些
4.1 工程结构
- 打开IDEA或Eclipse新建一个SpringBoot的应用.
4.2、SpringBoot配置和代码详解
4.2.1工程的pom.xml配置
- SpringBoot和Docker依赖的jar配置
<dependencies>
<!-- Springboot依赖的Jar包 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Springboot热部署jar-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<!--yml配置文件提示插件-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- spring-boot测试jar -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>springboot</finalName>
<!-- 一定要声明如下配置 打包xml 到Jar包 -->
<!-- <resources>
<