<?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>
    <groupId>org.alfresco</groupId>
    <artifactId>alfresco-shared-file-store</artifactId>
    <name>Alfresco Shared Content Store</name>
    <packaging>jar</packaging>
    <version>0.1</version>

    <parent>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-super-pom</artifactId>
        <version>9</version>
    </parent>


    <properties>
        <image.name>alfresco/alfresco-shared-file-store</image.name>
        <java.version>1.8</java.version>
        <image.tag>latest</image.tag>
        <dependency.fabric8.version>3.5.37</dependency.fabric8.version>
        <dependency.spring-boot.version>1.5.13.RELEASE</dependency.spring-boot.version>
        <dependency.alfresco-core.version>7.3</dependency.alfresco-core.version>
        <dependency.ch-qos-logback.version>1.2.3</dependency.ch-qos-logback.version>
        <env.project_version>${project.version}</env.project_version>

        <image.registry>quay.io</image.registry>
    </properties>

    <scm>
        <connection>scm:git:git@github.com:Alfresco/alfresco-shared-file-store.git</connection>
        <developerConnection>scm:git:git@github.com:Alfresco/alfresco-shared-file-store.git</developerConnection>
        <url>https://github.com/Alfresco/alfresco-shared-file-store</url>
        <tag>alfresco-shared-file-store-0.1</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-core</artifactId>
            <version>${dependency.alfresco-core.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.24</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.25</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${dependency.spring-boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>fabric8-maven-plugin</artifactId>
                <version>${dependency.fabric8.version}</version>
                <configuration>
                    <images>
                        <image>
                            <name>${image.name}:${image.tag}</name>
                            <build>
                                <dockerFileDir>${project.basedir}/</dockerFileDir>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>enterpriseDocker</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>fabric8-maven-plugin</artifactId>
                        <version>${dependency.fabric8.version}</version>
                        <executions>
                            <execution>
                                <id>build-image</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>internal</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>fabric8-maven-plugin</artifactId>
                        <version>${dependency.fabric8.version}</version>
                        <configuration>
                            <images>
                                <image>
                                    <name>${image.registry}/${image.name}:${image.tag}</name>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>build-push-image</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>master</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>fabric8-maven-plugin</artifactId>
                        <version>${dependency.fabric8.version}</version>
                        <configuration>
                            <images>
                                <image>
                                    <name>${image.registry}/${image.name}</name>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                    </build>
                                </image>
                                <image>
                                    <name>${image.name}</name>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>build-push-image</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>fabric8-maven-plugin</artifactId>
                        <version>${dependency.fabric8.version}</version>
                        <configuration>
                            <images>
                                <image>
                                    <name>${image.name}:${project.version}</name>
                                    <registry>${image.registry}</registry>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                    </build>
                                </image>
                                <image>
                                    <name>${image.name}:${project.version}</name>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>build-push-image</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>${dependency.spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${dependency.ch-qos-logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-access</artifactId>
                <version>${dependency.ch-qos-logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${dependency.ch-qos-logback.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>
