<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.cloudimpl</groupId>
        <artifactId>cluster4j</artifactId>
        <version>2.1.0.9</version>
    </parent>
    <artifactId>cluster-example</artifactId>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cluster-impl</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
    <properties>
        
    </properties>
    <profiles>
        <profile>
            <id>dev</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.google.cloud.tools</groupId>
                        <artifactId>jib-maven-plugin</artifactId>
                        <version>2.4.0</version>    
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <allowInsecureRegistries>true</allowInsecureRegistries>
                            <from>
                                <image>adoptopenjdk/openjdk11</image>
                            </from>
                            <to>
                                <image>localhost:5000/${project.groupId}/${project.artifactId}</image>
                                <!--<credHelper>osxkeychain</credHelper>-->
                                <tags>
                                    <tag>${project.version}</tag>
                                    <tag>latest</tag>
                                </tags>
                            </to>
                            <container>
                                <jvmFlags>
                                    <jvmFlag>-Xms512m</jvmFlag>
                                    <jvmFlag>-Xdebug</jvmFlag>
                                    <!--<jvmFlag>-Xmy:flag=jib-rules</jvmFlag>-->
                                </jvmFlags>
                                <mainClass>com.cloudimpl.cluster4j.app.CloudApp</mainClass>
                                <args>
                                    <arg>some</arg>
                                    <arg>args</arg>
                                </args>
                                <ports>
                                    <port>1000</port>
                                    <port>2000-2003/udp</port>
                                </ports>
                                <labels>
                                    <key1>value1</key1>
                                    <key2>value2</key2>
                                </labels>
                                <format>OCI</format>
                                <environment>
                                    <app.version>${project.version}</app.version>
                                    <app.name>${project.artifactId}</app.name>
                                </environment>
                            </container>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>prod</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.google.cloud.tools</groupId>
                        <artifactId>jib-maven-plugin</artifactId>
                        <version>2.4.0</version>    
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <from>
                                <image>adoptopenjdk/openjdk11</image>
                            </from>
                            <to>
                                <image>registry.hub.docker.com/nuwansa/${project.artifactId}</image>
                                <!--<credHelper>osxkeychain</credHelper>-->
                                <tags>
                                    <tag>${project.version}</tag>
                                    <tag>latest</tag>
                                </tags>
                            </to>
                            <container>
                                <jvmFlags>
                                    <jvmFlag>-Xms512m</jvmFlag>
                                    <jvmFlag>-Xdebug</jvmFlag>
                                    <!--<jvmFlag>-Xmy:flag=jib-rules</jvmFlag>-->
                                </jvmFlags>
                                <mainClass>com.cloudimpl.cluster4j.app.CloudApp</mainClass>
                                <args>
                                    <arg>some</arg>
                                    <arg>args</arg>
                                </args>
                                <ports>
                                    <port>1000</port>
                                    <port>2000-2003/udp</port>
                                </ports>
                                <labels>
                                    <key1>value1</key1>
                                    <key2>value2</key2>
                                </labels>
                                <format>OCI</format>
                                <environment>
                                    <app.version>${project.version}</app.version>
                                    <app.name>${project.artifactId}</app.name>
                                </environment>
                            </container>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    
</project>