0

I am creating docker images with the JIB module from google for maven. I configured my POM.XML.

My goal


Create two Images, one with a dynamic tag 1ef234f, and one static latest)

My try


As you can see, i tried to define two executions, however, just the first one is executed. I also tried within the JIB module, e.g. two , or two , however nothing is working. Actually I thought maven should be able to do two executions?

My POM.xml


       <profile>
        <id>buildImage</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.google.cloud.tools</groupId>
                    <artifactId>jib-maven-plugin</artifactId>
                    <version>3.3.1</version>
                    <executions>
                        <execution>
                            <id>create-image-snapshot-version</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                            <configuration>
                                <skip>false</skip>
                                <allowInsecureRegistries>true</allowInsecureRegistries>
                                <from>
                                    <image>${base.image}</image>
                                </from>
                                <to>
                                    <image>${image.repo}:${image.tag}</image>
                                </to>
                                <container>
                                    <jvmFlags>
                                        <jvmFlag>-Xmx2G</jvmFlag>
                                    </jvmFlags>
                                </container>
                            </configuration>
                        </execution>
                        <execution>
                            <id>create-image-latest</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                            <configuration>
                                <skip>false</skip>
                                <allowInsecureRegistries>true</allowInsecureRegistries>
                                <from>
                                    <image>${base.image}</image>
                                </from>
                                <to>
                                    <image>${image.repo}:latest</image>
                                </to>
                                <container>
                                    <jvmFlags>
                                        <jvmFlag>-Xmx2G</jvmFlag>
                                    </jvmFlags>
                                </container>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
emplo yee
  • 205
  • 2
  • 13

1 Answers1

0

Okay, i found the solution. @Chanseok Oh was actually right, but it needs to be like

 <from>
        <image>${base.image}</image>
 </from>
 <to>                                      
    <image>${image.repo}:${image.tag}</image>
 <tags>
     <tag>latest</tag>                               
 </tags>
 </to>
emplo yee
  • 205
  • 2
  • 13