【发布时间】:2017-11-17 04:49:39
【问题描述】:
我在 pom.xml 中配置了 fabric8 docker-maven-plugin,如下所示:
<build>
...
<plugins>
...
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<images>
<image>
<name>${docker.image.prefix}/${project.artifactId}:%l</name>
<build>
<dockerFile>Dockerfile</dockerFile>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</build>
</image>
</images>
</configuration>
</plugin>
...
</plugins>
...
</build>
我使用%l 占位符,如果版本包含-SNAPSHOT,则使用latest 标签标记图像,否则使用pom 版本。
从 CI 构建时,我想在我的图像中包含一些额外的标签(可能不止一个)(例如内部版本号/分支名称),但我想保留 %l 占位符行为。
我认为应该可以从命令行使用 maven 属性,但我无法从插件文档中弄清楚 (https://dmp.fabric8.io/)
如何在执行 docker:build 目标时包含额外的标签?
【问题讨论】:
标签: maven docker docker-maven-plugin