具体的harbor配置和docker配置可以查看前面几篇,也包含了我遇到的问题

settings.xml配置

<server>
<id>docker-hub</id>
<username>admin</username>
<password>Harbor12345</password>
</server>

pom.xml配置

</parent>
<groupId>com.topcheer</groupId>
<artifactId>docker</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>docker</name>
<description>Demo project for Spring Boot</description> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<docker.image.prefix>topcheer</docker.image.prefix>
<docker.repostory>192.168.180.105:1180</docker.repostory>
</properties> <dependencies> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies> <repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories> <build>
<finalName>docker</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--加入下面两项配置-->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag-image</id>
<phase>package</phase>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<image>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</image>
<newName>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</newName>
</configuration>
</execution>
<execution>
<id>push-image</id>
<phase>deploy</phase>
<goals>
<goal>push</goal>
</goals>
<configuration>
<imageName>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</imageName>
</configuration>
</execution>
</executions>
<configuration>
<serverId>docker-hub</serverId>
<registryUrl>${docker.repostory}</registryUrl>
<dockerHost>http://192.168.180.105:2375</dockerHost>
<forceTags>true</forceTags>
<pushImage>true</pushImage>
<dockerDirectory>src/main/docker</dockerDirectory>
<imageName>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</imageName>
<imageTags>
<imageTag>1.0.2</imageTag>
</imageTags>
<resources>
<rescource>
<targetPath></targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</rescource>
</resources>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>

运行命令

clean package docker:build -DpushImage -Dmaven.test.skip=true

spring boot 应用发布到Harbor上的更多相关文章

  1. Spring Boot工程发布到Docker

    先聊聊闲话 搞过企业级的application运维的同仁肯定深有感触,每个application的功能交叉错杂,数据交换就让人焦头烂额(当然这和顶层业务设计有关系), 几十个application发布 ...

  2. spring boot项目发布tomcat容器(包含发布到tomcat6的方法)

    spring boot因为内嵌tomcat容器,所以可以通过打包为jar包的方法将项目发布,但是如何将spring boot项目打包成可发布到tomcat中的war包项目呢? 1. 既然需要打包成wa ...

  3. spring boot下MultipartHttpServletRequest如何提高上传文件大小的默认值

    前言: 上传下载功能算是一个非常常见的功能,如果使用MultipartHttpServletRequest来做上传功能. 不配置上传大小的话,默认是2M.在有些场景,这个肯定不能满足条件. 上传代码: ...

  4. 从零开始的Spring Boot(3、Spring Boot静态资源和文件上传)

    Spring Boot静态资源和文件上传 写在前面 从零开始的Spring Boot(2.在Spring Boot中整合Servlet.Filter.Listener的方式) https://www. ...

  5. 将Spring Boot项目运行在Docker上

    将Spring Boot项目运行在Docker上 一.使用Dockerfile构建Docker镜像 1.1Dockerfile常用指令 1.1.1ADD复制文件 1.1.2ARG设置构建参数 1.1. ...

  6. Spring Boot 2 发布与调用REST服务

    开发环境:IntelliJ IDEA 2019.2.2Spring Boot版本:2.1.8 一.发布REST服务 1.IDEA新建一个名称为rest-server的Spring Boot项目 2.新 ...

  7. Spring Boot会员管理系统——处理文件上传

    温馨提示 Spring Boot会员管理系统的中,需要涉及到Spring框架,SpringMVC框架,Hibernate框架,thymeleaf模板引擎.所以,可以学习下这些知识.当然,直接入门的话使 ...

  8. Spring Boot 静态资源映射与上传文件路由配置

    默认静态资源映射目录 默认映射路径 在平常的 web 开发中,避免不了需要访问静态资源,如常规的样式,JS,图片,上传文件等;Spring Boot 默认配置对静态资源映射提供了如下路径的映射 /st ...

  9. Spring Boot 项目发布到 Tomcat 服务器

    第 1 步:将这个 Spring Boot 项目的打包方式设置为 war.<packaging>war</packaging> SpringBoot 默认有内嵌的 tomcat ...

随机推荐

  1. win10+jdk+mysql+tomcat+jpress环境搭建与部署

    本机搭建jpress用于接口测试的学习 目录 1.环境与工具准备 2.mysql服务端安装 3.tomcat配置 4.jpress部署 1.环境与工具准备 a.服务器为本机为win10 64位 b.j ...

  2. tips for using shortcuts

    tips for using shortcuts for mac: command+ctrl+F:full screen(当前应用全屏之后有一个好处 就是 使用 4 tap 的手势 可以在全屏的界面之 ...

  3. ES6新增特性

    ES6:  ECMA 第六次改版   块级作用域:   凡是被{ }包裹住的代码都是块级作用域,除了对象       特点:会造成一个暂时性死区    新增声明变量的两种方式: let:     a. ...

  4. dom元素的自上而下自动滚动

    dom元素的自上而下自动滚动 <!doctype html> <html lang="en"> <head> <meta charset= ...

  5. Tesseract5.0训练字库,提高OCR特殊场景识别率,合并字库(二)

    一.准备工作 需要的文件 tif文件和box文件. 如果你打标打好了,但是是分批次打标的,那么可以合并字库,我们最初只需要 tif 和 box 文件,如下: 二.生成对应的 .tr 训练文件 根据不同 ...

  6. python中pycharm中.py文件调用一个.py文件的函数

    在相同文件夹内调用函数: file1.py def add(x,y): print('和为:%d'%(x+y)) file2.py import A A.add(1,2)

  7. SpringBoot使用RestTemplate 摘要认证

    SpringBoot使用RestTempate SpringBoot使用RestTemplate摘要认证 SpringBoot使用RestTemplate基础认证 SpringBoot使用RestTe ...

  8. Vue组件定义

    简介 组件是可复用的 Vue 实例. 本质上是一个对象,该对象包含data.computed.watch.methods.filters以及生命周期钩子等成员属性. 组件结构: { data(){ r ...

  9. Angular ngTemplateOutlet

    虽然我们可以通过使用 ViewContainerRef 将 ElementRef创建的视图插入指定的位置,但是仍然希望有某中快捷的方式帮我们实现. ngTemplateOutlet与ngCompone ...

  10. ssh: Could not resolve hostname github.com: Name or service not known

    问题描述 今天早上在自己的虚拟机上用git pull命令更新github上的版本库时提示下面的错误 [root@localhost ~] git clone git@github.com:sdscbr ...