1)在工程的pom.xml文件中添加Docker插件
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<baseImage>java:8</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.war"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.war</include>
</resource>
</resources>
</configuration>
</plugin>
工程本身包含了前端代码,打的是war包(打成jar包会导致页面不可访问)
<packaging>war</packaging>
2)在pom.xml目录下执行
mvn package docker:build
所有评论(0)