黑马十次方项目day09-10 之使用持续集成发布eureka

使用持续集成发布eureka

在Jenkins中创建一个maven项目,起名为tensquare_eureka
黑马十次方项目day09-10 之使用持续集成发布eureka
源码管理, 选择Git. 其中Url为Gogs中的路径
黑马十次方项目day09-10 之使用持续集成发布eureka
修改tensquare_eureka模块的pom文件内容,加入docker的插件

<build>
        <finalName>app</finalName>
        <plugins>
            <!--SpringBoot的maven插件 -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <!-- docker的maven插件,官网 https://github.com/spotify/docker-maven-plugin -->
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.4.13</version>
                <configuration>
                    <imageName>ip:5000/${project.artifactId}:${project.version}</imageName>
                    <baseImage>jdk1.8</baseImage>
                    <!--执行java -jar的命令,打成jar包 -->
                    <entryPoint>["java", "-jar","/${project.build.finalName}.jar"]</entryPoint>
                    <resources>
                        <resource>
                            <!--docker内进行打包 -->
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                    <dockerHost>http://ip:2375</dockerHost>
                </configuration>
            </plugin>
        </plugins>
    </build>

修改bootstrap.yml 中的config配置中心的地址为Linux的ip
修改完这两个文件后,上传到Gogs中.

在Jenkins的Build模块中,修改Root POM的值为tensquare_eureka/pom.xml,默认为pom.xml,此时读取的是父工程的pom.xml,因此需要修改为tensquare_eureka/pom.xml.
Goals and options 这一项,为固定的docker创建容器和上传镜像的命令
clean package docker:build -DpushImage
黑马十次方项目day09-10 之使用持续集成发布eureka
配置完上面的步骤之后,点击右侧的圈,即可开始构建
黑马十次方项目day09-10 之使用持续集成发布eureka
点击左边正在执行的任务
黑马十次方项目day09-10 之使用持续集成发布eureka
可以看到实时输出的日志,看到下面的结果就表示你已经成功了黑马十次方项目day09-10 之使用持续集成发布eureka
在浏览器看一下docker私有仓库
http://192.168.184.135:5000/v2/_catalog ,会看到tensquare_eureka已经上传成功了
{"repositories":["jdk1.8","tensquare_eureka"]}
就可以在docker中制作容器, 开启Eureka的微服务了.