zoukankan      html  css  js  c++  java
  • 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  看效果

  • 相关阅读:
    px和rem换算
    使用Android Studio创建Android项目
    Hopscotch
    AtCoder Grand Contest 010 --C:Cleaning
    Hello world!
    概率生成函数
    FFT 学习笔记
    扩展中国剩余定理(excrt)
    组合恒等式
    常见数列
  • 原文地址:https://www.cnblogs.com/sunju/p/12123563.html
Copyright © 2011-2022 走看看