Skip to content

Commit

Permalink
[resolves #98] Use docker-maven-plugin to generate images
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Jul 20, 2015
1 parent 9e6e997 commit 32d4ee9
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 87 deletions.
23 changes: 0 additions & 23 deletions docker/etc/context/Dockerfile

This file was deleted.

97 changes: 56 additions & 41 deletions docker/pom.xml
Expand Up @@ -37,7 +37,11 @@
<!-- Properties -->
<properties>
<docker.image.name>wildflyext/wildfly-camel</docker.image.name>
<docker.image.from>wildflyext/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 -->
Expand All @@ -55,58 +59,69 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<id>remove-images</id>
<phase>clean</phase>
<goals>
<goal>single</goal>
<goal>remove</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<finalName>docker</finalName>
<descriptors>
<descriptor>scripts/assembly-artifacts.xml</descriptor>
</descriptors>
<images>
<image>
<name>${docker.image.name}:${docker.image.version}</name>
</image>
<image>
<name>${docker.image.name}:${project.version}</name>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<id>build-docker-image</id>
<phase>install</phase>
<goals>
<goal>run</goal>
<goal>build</goal>
</goals>
<configuration>
<target>
<exec executable="docker" failonerror="false">
<arg value="rmi" />
<arg value="--force=true" />
<arg value="${docker.image.name}:${docker.image.version}" />
<arg value="${docker.image.name}:${project.version}" />
</exec>
<exec executable="docker" error="target/build.err" failonerror="true">
<arg value="build" />
<arg value="--force-rm=true" />
<arg value="--rm=true" />
<arg value="-t" />
<arg value="${docker.image.name}:${docker.image.version}" />
<arg value="target/docker" />
</exec>
<exec executable="docker" error="target/tag.err" failonerror="true">
<arg value="tag" />
<arg value="${docker.image.name}:${docker.image.version}" />
<arg value="${docker.image.name}:${project.version}" />
</exec>
<echo>=========================================================================</echo>
<echo>docker run --rm -ti -p 8080:8080 -p 9990:9990 -e WILDFLY_MANAGEMENT_USER=admin -e WILDFLY_MANAGEMENT_PASSWORD=admin ${docker.image.name}</echo>
<echo>=========================================================================</echo>
</target>
<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>
Expand Down
9 changes: 3 additions & 6 deletions docker/scripts/assembly-artifacts.xml
Expand Up @@ -29,13 +29,11 @@

<fileSets>
<fileSet>
<outputDirectory>/</outputDirectory>
<outputDirectory>bin</outputDirectory>
<directory>etc/context</directory>
<includes>
<include>Dockerfile</include>
<include>entrypoint.sh</include>
</includes>
<filtered>true</filtered>
</fileSet>
</fileSets>

Expand All @@ -45,10 +43,9 @@
<includes>
<include>org.wildfly.camel:wildfly-camel-patch:tar.gz</include>
</includes>
<outputDirectory>.</outputDirectory>
<scope>provided</scope>
<unpack>false</unpack>
<unpack>true</unpack>
</dependencySet>
</dependencySets>


</assembly>
28 changes: 11 additions & 17 deletions examples/camel-rest/pom.xml
Expand Up @@ -37,6 +37,7 @@
<!-- Properties -->
<properties>
<docker.image.name>wildflyext/${project.artifactId}</docker.image.name>
<docker.removeAll>true</docker.removeAll>
</properties>

<!-- Dependencies -->
Expand Down Expand Up @@ -119,30 +120,23 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<id>remove-images</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
<goal>remove</goal>
</goals>
<configuration>
<target>
<exec executable="docker" failonerror="false">
<arg value="rmi" />
<arg value="--force=true" />
<arg value="${docker.image.name}" />
</exec>
</target>
<images>
<image>
<name>${docker.image.name}</name>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-docker-image</id>
<phase>install</phase>
Expand Down

0 comments on commit 32d4ee9

Please sign in to comment.