<?xml version="1.0" encoding="UTF-8"?>
<!--~
  ~ Copyright 2017 Confluent Inc.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~-->
<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>io.confluent</groupId>
        <artifactId>common-docker</artifactId>
        <version>8.0.2</version>
    </parent>

    <packaging>pom</packaging>

    <artifactId>cp-base-java</artifactId>

    <description>Base for new Confluent lightweight Docker images</description>
    <name>${project.artifactId}</name>

    <properties>
        <docker.skip-build>false</docker.skip-build>
        <docker.skip-test>false</docker.skip-test>
        <docker.pull-image>true</docker.pull-image>
        <docker.file>Dockerfile.ubi9</docker.file>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>utility-belt</artifactId>
            <version>${io.confluent.common-docker.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Operator dependencies for metrics integration -->
        <dependency>
            <groupId>org.jolokia</groupId>
            <artifactId>jolokia-jvm</artifactId>
            <version>${jolokia-jvm.version}</version>
        </dependency>

        <dependency>
            <groupId>io.prometheus.jmx</groupId>
            <artifactId>jmx_prometheus_javaagent</artifactId>
            <version>${jmx_prometheus_javaagent.version}</version>
        </dependency>

        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>disk-usage-agent</artifactId>
            <version>${io.confluent.common.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-reload4j</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
        </dependency>

        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>logredactor</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <overwrite>true</overwrite>
                            <outputDirectory>target</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/../docker-utils/target</directory>
                                    <includes>
                                        <include>docker-utils-${CONFLUENT_VERSION}-jar-with-dependencies.jar</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <configuration>
                    <buildArgs>
                        <UBI_MINIMAL_VERSION>${ubi9.minimal.image.version}</UBI_MINIMAL_VERSION>
                        <TEMURIN_JDK_VERSION>-${ubi.temurin.jdk.version}</TEMURIN_JDK_VERSION>
                        <SKIP_SECURITY_UPDATE_CHECK>${docker.skip-security-update-check}</SKIP_SECURITY_UPDATE_CHECK>
                        <GOLANG_VERSION>${golang.version}</GOLANG_VERSION>
                        <CRYPTO_POLICIES_SCRIPTS_VERSION>-${ubi9.crypto.policies.scripts.version}</CRYPTO_POLICIES_SCRIPTS_VERSION>
                        <FINDUTILS_VERSION>-${ubi9.findutils.version}</FINDUTILS_VERSION>
                        <HOSTNAME_VERSION>-${ubi9.hostname.version}</HOSTNAME_VERSION>
                    </buildArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.43.4</version>
                <configuration>
                    <images>
                        <image>
                            <build>
                                <args>
                                    <UBI_MINIMAL_VERSION>${ubi9.minimal.image.version}</UBI_MINIMAL_VERSION>
                                    <TEMURIN_JDK_VERSION>-${ubi.temurin.jdk.version}</TEMURIN_JDK_VERSION>
                                    <SKIP_SECURITY_UPDATE_CHECK>
                                        ${docker.skip-security-update-check}
                                    </SKIP_SECURITY_UPDATE_CHECK>
                                    <GOLANG_VERSION>${golang.version}</GOLANG_VERSION>
                                    <CRYPTO_POLICIES_SCRIPTS_VERSION>-${ubi9.crypto.policies.scripts.version}</CRYPTO_POLICIES_SCRIPTS_VERSION>
                                    <FINDUTILS_VERSION>-${ubi9.findutils.version}</FINDUTILS_VERSION>
                                    <HOSTNAME_VERSION>-${ubi9.hostname.version}</HOSTNAME_VERSION>
                                </args>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
