• spring-boot pom.xml 配置给docker打时间戳


    在你想加入时间戳的项目里加入以下内容,pom.xml里面


    在<plugins>下面加入插件 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.4</version> <configuration> <timestampFormat>yyyyMMddHHmmss</timestampFormat>#设置时间格式 </configuration> <executions> <execution> <goals> <goal>create-timestamp</goal> </goals> </execution> </executions> <inherited>false</inherited> </plugin>

      然后在docker 插件里面加入

     <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>${docker.plugin.version}</version>
                    <configuration>
                          <forceTags>true</forceTags>  #强制添加标签
                          <imageTags>
                               <imageTag>${project.artifactId}:${project.version}-${timestamp}</imageTag> #强制标签的位置
                          </imageTags>
                        <imageName>${docker.registry.url}/blade/${project.artifactId}:${project.version}</imageName>
                        <dockerDirectory>${project.basedir}</dockerDirectory>
                        <dockerHost>${docker.registry.host}</dockerHost>
                        <resources>
                            <resource>
                                <targetPath>/</targetPath>
                                <directory>${project.build.directory}</directory>
                                <include>${project.build.finalName}.jar</include>
                            </resource>
                        </resources>
                        <registryUrl>${docker.registry.url}</registryUrl>
                        <serverId>${docker.registry.url}</serverId>
                        <pushImage>true</pushImage>
                    </configuration>
                </plugin>

    cd 到项目里然后执行命令:mvn clean package docker:build  看效果

  • 相关阅读:
    VS2010/MFC编程入门之三(VS2010应用程序工程中文件的组成结构)
    VS2010/MFC编程入门之二(利用MFC向导生成单文档应用程序框架)
    VS2010/MFC编程入门之一(VS2010与MSDN安装过程图解)
    Getmemory问题
    计算后缀表达式
    0-1背包问题
    不抛异常的swap函数
    输出n*n矩阵
    字符串全排列输出
    判断主机字节
  • 原文地址:https://www.cnblogs.com/sunju/p/12123563.html
Copyright © 2020-2023  润新知