<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  Wildfly Camel Docker
  %%
  Copyright (C) 2013 - 2014 RedHat
  %%
  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.
  #L%
  -->


<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>

    <parent>
        <groupId>org.wildfly.camel</groupId>
        <artifactId>wildfly-camel</artifactId>
        <version>3.2.0</version>
    </parent>

    <name>Wildfly Camel :: Docker</name>

    <artifactId>wildfly-camel-docker</artifactId>
	<packaging>pom</packaging>
    
    <!-- Properties -->
    <properties>
        <docker.image.name>wildflyext/wildfly-camel</docker.image.name>
        <docker.image.from>jboss/wildfly:${version.wildfly}</docker.image.from>
        <docker.image.maintainer>Thomas Diesler tdiesler@redhat.com</docker.image.maintainer>
        <docker.image.version>latest</docker.image.version>
        <docker.removeAll>true</docker.removeAll>
        <server.config>standalone-camel.xml</server.config>
    </properties>
	
    <!-- Dependencies -->
    <dependencies>
    	<dependency>
	        <groupId>org.wildfly.camel</groupId>
	        <artifactId>wildfly-camel-patch</artifactId>
	        <version>${project.version}</version>
            <scope>provided</scope>
	        <type>tar.gz</type>
    	</dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jolokia</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>remove-images</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>remove</goal>
                        </goals>
                        <configuration>
                            <images>
                                <image>
                                    <name>${docker.image.name}:${docker.image.version}</name>
                                </image>
                                <image>
                                    <name>${docker.image.name}:${project.version}</name>
                                </image>
                            </images>
                        </configuration>
                    </execution>
                    <execution>
                        <id>build-docker-image</id>
                        <phase>install</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <images>
                                <image>
                                    <name>${docker.image.name}</name>
                                    <build>
                                        <maintainer>${docker.image.maintainer}</maintainer>
                                        <from>${docker.image.from}</from>
                                        <cmd>
                                            <exec>
                                                <args>-c</args>
                                                <args>${server.config}</args>
                                                <args>-b</args>
                                                <args>0.0.0.0</args>
                                                <args>-bmanagement</args>
                                                <args>0.0.0.0</args>
                                            </exec>
                                        </cmd>
                                        <entryPoint>
                                            <exec>
                                                <args>/opt/jboss/wildfly/bin/entrypoint.sh</args>
                                            </exec>
                                        </entryPoint>
                                        <ports>
                                            <port>9999</port>
                                        </ports>
                                        <tags>
                                            <tag>${docker.image.version}</tag>
                                            <tag>${project.version}</tag>
                                        </tags>
                                        <assembly>
                                            <basedir>/opt/jboss/wildfly</basedir>
                                            <descriptor>${project.basedir}/scripts/assembly-artifacts.xml</descriptor>
                                            <user>jboss:jboss:jboss</user>
                                        </assembly>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
