<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.apicurio</groupId>
        <artifactId>apicurio-registry-distro</artifactId>
        <version>2.6.12.redhat-00001</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>apicurio-registry-distro-docker</artifactId>
    <packaging>pom</packaging>
    <name>apicurio-registry-distro-docker</name>

    <properties>
        <docker.app.file>app-files/apicurio-registry-app-${project.version}-all.tar.gz</docker.app.file>
        <docker.sql.file>app-files/apicurio-registry-storage-sql-${project.version}-all.tar.gz</docker.sql.file>
        <quarkus.version>3.15.3.redhat-00002</quarkus.version>
        <docker.mssql.file>app-files/apicurio-registry-storage-mssql-${project.version}-all.tar.gz</docker.mssql.file>
        <docker.mysql.file>app-files/apicurio-registry-storage-mysql-${project.version}-all.tar.gz</docker.mysql.file>
        <docker.kafkasql.file>app-files/apicurio-registry-storage-kafkasql-${project.version}-all.tar.gz</docker.kafkasql.file>
        <docker.tenant-manager.file>app-files/apicurio-registry-tenant-manager-api-${project.version}-all.tar.gz</docker.tenant-manager.file>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-app</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-target-app</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/docker/app-files</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/../../app/target</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>apicurio-*.tar.gz</include>
                                        <include>apicurio-*runner</include>
                                    </includes>
                                </resource>
                                <resource>
                                    <directory>${basedir}/../../storage/sql/target</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>apicurio-*.tar.gz</include>
                                        <include>apicurio-*runner</include>
                                    </includes>
                                </resource>
                                <resource>
                                    <directory>${basedir}/../../storage/mssql/target</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>apicurio-*.tar.gz</include>
                                        <include>apicurio-*runner</include>
                                    </includes>
                                </resource>
                                <resource>
                                    <directory>${basedir}/../../storage/mysql/target</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>apicurio-*.tar.gz</include>
                                        <include>apicurio-*runner</include>
                                    </includes>
                                </resource>
                                <resource>
                                    <directory>${basedir}/../../storage/kafkasql/target</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>apicurio-*.tar.gz</include>
                                        <include>apicurio-*runner</include>
                                    </includes>
                                </resource>
                                <resource>
                                    <directory>${basedir}/../../multitenancy/tenant-manager-api/target</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>apicurio-*.tar.gz</include>
                                        <include>apicurio-*runner</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-docker</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/docker</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/docker</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
    
        <profile>
            <id>sql</id>
            <dependencies>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-storage-sql</artifactId>
                    <version>${project.version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>mssql</id>
            <dependencies>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-storage-mssql</artifactId>
                    <version>${project.version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>mysql</id>
            <dependencies>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-storage-mysql</artifactId>
                    <version>${project.version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>kafkasql</id>
            <dependencies>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-storage-kafkasql</artifactId>
                    <version>${project.version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>multitenancy</id>
            <dependencies>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-tenant-manager-api</artifactId>
                    <version>${project.version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>

    </profiles>

</project>
