<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>cn.bunny</groupId> <artifactId>service</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>service-admin</artifactId> <packaging>jar</packaging> <name>service-admin</name> <url>https://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <docker.repostory>192.168.3.100:1100</docker.repostory> <docker.host>192.168.3.100:2375</docker.host> <docker.registry.name>bunny-admin</docker.registry.name> </properties> <dependencies> <dependency> <groupId>cn.bunny</groupId> <artifactId>spring-security</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>cn.bunny</groupId> <artifactId>module-mail</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>cn.bunny</groupId> <artifactId>module-minio</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <!-- 消除 spring-security 黄色镜 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.2.2</version> <!--将插件绑定在某个phase执行--> <executions> <execution> <id>build-image</id> <!--将插件绑定在package这个phase(阶段)上。也就是说,用户只需执行mvn package,就会自动执行mvn docker:build--> <phase>package</phase> <goals> <goal>build</goal> <goal>push</goal> </goals> </execution> </executions> <configuration> <serverId>harbor</serverId> <registryUrl>http://${docker.repostory}</registryUrl> <!-- 配置docker主机地址 --> <dockerHost>http://${docker.host}</dockerHost> <!--指定生成的镜像名--> <imageName> ${docker.repostory}/${docker.registry.name}/${project.artifactId}:${project.version} </imageName> <!-- 指定 dockerfile 路径--> <dockerDirectory>${project.basedir}</dockerDirectory> <!-- 是否跳过docker构建 --> <skipDockerBuild>false</skipDockerBuild> </configuration> </plugin> </plugins> </build> </project>