<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.microbean</groupId>
  <artifactId>microbean-abstract-environment</artifactId>
  <version>0.3.2</version>
  <packaging>pom</packaging>  

  <parent>
    <groupId>org.microbean</groupId>
    <artifactId>microbean-pluginmanagement-pom</artifactId>
    <version>5</version>
  </parent>

  <name>microBean Abstract Environment</name>
  <description>${project.name}</description>
  <inceptionYear>2017</inceptionYear>
  <url>https://microbean.github.io/${project.artifactId}</url>

  <scm>
    <connection>scm:git:git@github.com:microbean/${project.artifactId}.git</connection>
    <developerConnection>scm:git:git@github.com:microbean/${project.artifactId}.git</developerConnection>
    <url>https://github.com/microbean/${project.artifactId}/</url>
    <tag>v0.3.2</tag>
  </scm>

  <dependencyManagement>
    <dependencies>

      
      <!-- Normal dependencies. -->
      
      
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>${project.artifactId}</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
      </dependency>

      <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.el</artifactId>
        <type>jar</type>
        <version>3.0.1-b09</version>
      </dependency>
      
      <dependency>
        <groupId>org.hibernate.validator</groupId>
        <artifactId>hibernate-validator-cdi</artifactId>
        <version>6.0.7.Final</version>
        <type>jar</type>
      </dependency>
      
      <dependency>
        <groupId>org.microbean</groupId>
        <artifactId>microbean-configuration</artifactId>
        <version>0.3.1</version>
        <type>jar</type>
      </dependency>

      <dependency>
        <groupId>org.microbean</groupId>
        <artifactId>microbean-configuration-api</artifactId>
        <version>0.3.0</version>
        <type>jar</type>
      </dependency>
      
      <dependency>
        <groupId>org.microbean</groupId>
        <artifactId>microbean-configuration-cdi</artifactId>
        <version>0.3.1</version>
        <type>jar</type>
      </dependency>
      
      <dependency>
        <groupId>org.microbean</groupId>
        <artifactId>microbean-main</artifactId>
        <version>6</version>
        <type>jar</type>
      </dependency>

    </dependencies>
  </dependencyManagement>

  <dependencies>


    <!-- Runtime-scoped dependencies. -->
    

    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.el</artifactId>
      <type>jar</type>
      <scope>runtime</scope>
    </dependency>
    
    <dependency>
      <groupId>org.hibernate.validator</groupId>
      <artifactId>hibernate-validator-cdi</artifactId>
      <type>jar</type>
      <scope>runtime</scope>
    </dependency>
    
    <dependency>
      <groupId>org.microbean</groupId>
      <artifactId>microbean-configuration</artifactId>
      <type>jar</type>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.microbean</groupId>
      <artifactId>microbean-configuration-api</artifactId>
      <type>jar</type>
      <scope>runtime</scope>
    </dependency>
    
    <dependency>
      <groupId>org.microbean</groupId>
      <artifactId>microbean-configuration-cdi</artifactId>
      <type>jar</type>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.microbean</groupId>
      <artifactId>microbean-main</artifactId>
      <type>jar</type>
      <scope>runtime</scope>
    </dependency>

  </dependencies>

  <build>

    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>io.fabric8</groupId>
          <artifactId>docker-maven-plugin</artifactId>
          <version>0.24.0</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>buildnumber-maven-plugin</artifactId>
          <version>1.4</version>
        </plugin>
        
      </plugins>
    </pluginManagement>
    
    <plugins>

      <plugin>
        <groupId>com.github.github</groupId>
        <artifactId>site-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <configuration>
          <images>
            <image>
              <name>microbean/microbean-base:%l</name>
              <build>
                <from>docker.io/anapsix/alpine-java:8u162b12_jdk</from>
                <assembly>
                  <targetDir>/microbean</targetDir>
                  <inline>
                    <dependencySets>
                      <dependencySet>
                        <useProjectArtifact>false</useProjectArtifact>
                      </dependencySet>
                    </dependencySets>
                  </inline>
                </assembly>
                <labels>
                  <build.git.sha1>${buildNumber}</build.git.sha1>
                  <build.git.branch>${scmBranch}</build.git.branch>
                  <build.timestamp>${timestamp}</build.timestamp>
                </labels>
                <entryPoint>
                  <exec>
                    <arg>java</arg>
                  </exec>
                </entryPoint>
                <env>
                  <CLASSPATH>/microbean/*</CLASSPATH>
                </env>
                <runCmds>
                  <run><![CDATA[adduser -g 'microbean' -h /microbean -s /sbin/nologin -D microbean && echo "microbean:microbean" | chpasswd && chown -R microbean:microbean /microbean]]></run>
                </runCmds>
                <tags>
                  <tag>latest</tag>
                </tags>
                <workdir>/microbean</workdir>
              </build>
            </image>
          </images>
        </configuration>
        <executions>
          <execution>
            <id>Build Docker image</id>
            <goals>
              <goal>build</goal>
            </goals>
            <phase>install</phase>
          </execution>
          <execution>
            <id>Push Docker image</id>
            <goals>
              <goal>push</goal>
            </goals>
            <phase>deploy</phase>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>Retrieve current build number (Git commit id)</id>
            <phase>initialize</phase>
            <goals>
              <goal>create</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      
    </plugins>
  </build>

  <properties>

    <!-- maven-release-plugin properties; see http://maven.apache.org/maven-release/maven-release-plugin/perform-mojo.html -->
    <goals>deploy,site-deploy</goals>
    <scmCommentPrefix>[maven-release-plugin] [skip ci]</scmCommentPrefix>

  </properties>
  
</project>
