<?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>org.factcast</groupId>
    <artifactId>factcast</artifactId>
    <version>0.8.0-M1</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>factcast-docker</artifactId>
  <properties>
    <docker.image.prefix>factcast</docker.image.prefix>
    <sonar.skip>true</sonar.skip>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.factcast</groupId>
        <artifactId>factcast-bom</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.factcast</groupId>
      <artifactId>factcast-spring-boot-autoconfigure</artifactId>
    </dependency>
    <dependency>
      <groupId>org.factcast</groupId>
      <artifactId>factcast-server-grpc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.factcast</groupId>
      <artifactId>factcast-store</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context-indexer</artifactId>
    </dependency>
  </dependencies>
  <build>
    <finalName>factcast</finalName>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
            <configuration>
              <executable>true</executable>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>

      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.44.0</version>
        <executions>
          <execution>
            <id>default</id>
            <goals>
              <goal>build</goal>
            </goals>
            <phase>pre-integration-test</phase>
          </execution>
        </executions>
        <configuration>
          <images>
            <image>
              <registry>docker.io</registry>
              <name>factcast/factcast</name>
              <build>
                <dockerFileDir>${project.basedir}</dockerFileDir>
                <tags>
                  <tag>latest</tag>
                </tags>
                <buildx>
                  <platforms>
                    <platform>linux/amd64</platform>
                    <platform>linux/arm64</platform>
                  </platforms>
                </buildx>
              </build>
            </image>
          </images>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>oss.push-docker-image</id>
      <activation>
        <property>
          <name>docker</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.44.0</version>
            <executions>
              <execution>
                <id>default</id>
                <goals>
                  <goal>build</goal>
                  <goal>push</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <images>
                <image>
                  <registry>docker.io</registry>
                  <name>factcast/factcast</name>
                  <build>
                    <dockerFileDir>${project.basedir}</dockerFileDir>
                    <tags>
                      <tag>latest</tag>
                      <tag>${project.version}</tag>
                    </tags>
                    <buildx>
                      <platforms>
                        <platform>linux/amd64</platform>
                        <platform>linux/arm64</platform>
                      </platforms>
                    </buildx>
                  </build>
                </image>
              </images>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
