我有一个spring boot maven项目,需要构建一个docker镜像:
"Microsoft.NETCore.App": {
"type": "default",
"version": "1.0.0-*"
}
作为用户" eugene"我可以毫无问题地运行以下命令:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag-image</id>
<phase>package</phase>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<image>api</image>
<newName>registry.example.com/api</newName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/docker</directory>
<filtering>true</filtering>
<includes>
<include>Dockerfile</include>
</includes>
</resource>
</resources>
</build>
我已经在我的Mac上本地安装了Jenkins,并创建了一个运行此Maven目标的作业:
mvn -X package docker:build
Jenkins构建失败,出现以下控制台输出:
package docker:build
我该怎么做才能解决这个问题,让Jenkins构建我的应用程序的docker镜像?