如何把spring boot應(yīng)用發(fā)布到Harbor
這篇文章主要介紹了如何把spring boot應(yīng)用發(fā)布到Harbor,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
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> <!--加入下面兩項(xiàng)配置--> <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>
運(yùn)行命令
clean package docker:build -DpushImage -Dmaven.test.skip=true
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Java基于PDFbox實(shí)現(xiàn)讀取處理PDF文件
PDFbox是一個(gè)開源的、基于Java的、支持PDF文檔生成的工具庫,它可以用于創(chuàng)建新的PDF文檔,修改現(xiàn)有的PDF文檔,還可以從PDF文檔中提取所需的內(nèi)容。本文將具體介紹一下PDFbox讀取處理PDF文件的示例代碼,感興趣的可以學(xué)習(xí)一下2022-02-02SpringBoot實(shí)現(xiàn)devtools實(shí)現(xiàn)熱部署過程解析
這篇文章主要介紹了SpringBoot實(shí)現(xiàn)devtools實(shí)現(xiàn)熱部署過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-03-03JavaSE經(jīng)典小練習(xí)項(xiàng)目之拷貝文件夾
文件拷貝是一個(gè)常見的任務(wù),無論是備份文件,還是將文件從一個(gè)位置復(fù)制到另一個(gè)位置,文件拷貝都是必不可少的,這篇文章主要給大家介紹了關(guān)于JavaSE經(jīng)典小練習(xí)項(xiàng)目之拷貝文件夾的相關(guān)資料,需要的朋友可以參考下2023-10-10java 靜態(tài)鏈表實(shí)現(xiàn)示例詳解
這篇文章主要為大家介紹了java 靜態(tài)鏈表實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-06-06