将docker插件调整为dockerfile-maven-plugin docker-maven-plugin

Docker 未结 2 2715
路法师
路法师 剑童 2019-05-17 15:29

docker-maven-plugin 作者已不推荐使用,并建议迁移至

dockerfile-maven-plugin


2条回答
  • 2019-05-17 15:31

    <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>dockerfile-maven-plugin</artifactId>
        <version>${dockerfile-maven-version}</version>
        <executions>
            <execution>
                <id>default</id>
                <goals>
                    <goal>build</goal>
                    <goal>push</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <repository>${docker.registry.url}/blade/${project.artifactId}</repository>
            <tag>${project.version}</tag>
            <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
            <buildArgs>
                <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
            </buildArgs>
        </configuration>
    </plugin>


    配置如上。从jenkins耗时看,性能有较大的提升

    PS:jenkins使用可能遇到权限不足的报错

    Permission denied

    执行sudo usermod -aG docker jenkins后重启jenkins即可



    0 讨论(0)
  • 2020-08-21 16:46

    这种方式需要在linux部署 jenkins 对么

    0 讨论(0)
提交回复