You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/01/09 22:40:34 UTC

[14/22] isis git commit: ISIS-1558: replaces configuration with mavenmixin-docker.

ISIS-1558: replaces configuration with mavenmixin-docker.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/735cb819
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/735cb819
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/735cb819

Branch: refs/heads/master
Commit: 735cb8193c6d16c78143d84b6ca678562d48bfce
Parents: 0febb58
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Dec 22 17:28:33 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Dec 22 17:28:33 2016 +0000

----------------------------------------------------------------------
 example/application/simpleapp/README.adoc       | 40 ++++++++++-
 example/application/simpleapp/pom.xml           |  2 +-
 example/application/simpleapp/webapp/pom.xml    | 74 ++------------------
 .../webapp/src/main/resources/docker/Dockerfile |  1 -
 4 files changed, 46 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/735cb819/example/application/simpleapp/README.adoc
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/README.adoc b/example/application/simpleapp/README.adoc
index df457bb..e61edec 100644
--- a/example/application/simpleapp/README.adoc
+++ b/example/application/simpleapp/README.adoc
@@ -51,7 +51,7 @@ Larger applications should consist of multiple modules; each such module can be
 ====
 
 |`webapp`
-|Assembles the application into a webapp (comprising both the Wicket viewer and Restful Objects viewer) and runs the `isis:swagger` goal.
+|Assembles the application into a webapp (comprising both the Wicket viewer and Restful Objects viewer) and also as a docker image, and runs the `isis:swagger` goal.
 
 |`_checks`
 |Checkstyle and PMD rule sets for static analysis.
@@ -88,6 +88,21 @@ cd webapp/target && java -jar simpleapp-webapp-xxx-jetty-console.war
 ----
 +
 Add additional flags, eg ``--headless`` or ``--port 9999``, if required.
++
+It can also be run using: +
++
+[source,bash]
+----
+mvn -pl webapp && mvn antrun:run -Dmavenmixin-jettyconsole
+----
++
+or to specify arguments:
++
+[source,bash]
+----
+mvn -pl webapp && mvn antrun:run -Dmavenmixin-jettyconsole \
+    -Dmaven-antrun-plugin.jettyconsole.args="--headless --port 9090"
+----
 
 
 * To also generate source and javadoc JARs:
@@ -191,4 +206,27 @@ mvn -Dskip.danhaywood-mavenmixin-isisswagger
 By default, Swagger spec files are generated at `target/generated-resources/isis-swagger` (in the ``webapp`` module).
 ====
 
+* To package up the application as a docker image: +
++
+[source,bash]
+----
+mvn package -Dmavenmixin-docker
+----
++
+This assumes that the `${docker-plugin.imageName}` property has been defined in the `webapp` module.
+Alternatively it can be specified on the command line using a system property, eg:
++
+[source,bash]
+----
+mvn package -Dmavenmixin-docker -Ddocker-plugin.imageName=mycompany/myapp
+----
 
+* To upload the application as a docker image to link:https://hub.docker.com[docker hub]: +
++
+[source,bash]
+----
+mvn deploy -Dmavenmixin-docker
+----
++
+This once again assumes that the `${docker-plugin.imageName}` property has been defined, _and_ also that docker registry credentials have been specified in `~/.m2/settings.xml`.
+See link:https://github.com/danhaywood/java-mavenmixin-docker#how-to-configure[mavenmixin-docker] for further details.

http://git-wip-us.apache.org/repos/asf/isis/blob/735cb819/example/application/simpleapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/pom.xml b/example/application/simpleapp/pom.xml
index 0616fa7..464ffdf 100644
--- a/example/application/simpleapp/pom.xml
+++ b/example/application/simpleapp/pom.xml
@@ -89,7 +89,7 @@
         <jdepend-maven-plugin.version>2.0-beta-2</jdepend-maven-plugin.version>
         <findbugs-maven-plugin.version>2.5</findbugs-maven-plugin.version>
 
-        <mavenmixin-docker.version>0.0.1-SNAPSHOT</mavenmixin-docker.version>
+        <mavenmixin-docker.version>0.0.2</mavenmixin-docker.version>
         <maven-deploy-plugin.version>2.8.1</maven-deploy-plugin.version>
         <docker-maven-plugin.version>0.4.13</docker-maven-plugin.version>
 

http://git-wip-us.apache.org/repos/asf/isis/blob/735cb819/example/application/simpleapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index 41d77bb..d0a2e40 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -43,9 +43,8 @@
 
         <maven-war-plugin.warName>${project.parent.artifactId}</maven-war-plugin.warName>
 
-        <docker-plugin.imageName>danhaywood/isis-app-simpleapp</docker-plugin.imageName>
+        <docker-plugin.imageName>DOCKER_REGISTRY_ACCOUNT/${project.parent.artifactId}</docker-plugin.imageName>
         <docker-plugin.resource.include>${maven-war-plugin.warName}.war</docker-plugin.resource.include>
-        <docker-plugin.maintainer>Apache Isis committers</docker-plugin.maintainer>
         <docker-plugin.serverId>docker-hub</docker-plugin.serverId>
         <docker-plugin.registryUrl>https://index.docker.io/v1/</docker-plugin.registryUrl>
 
@@ -128,76 +127,15 @@
                             <artifactId>jettyconsole</artifactId>
                             <version>${mavenmixin-jettyconsole.version}</version>
                         </mixin>
+                        <mixin>
+                            <groupId>com.danhaywood.mavenmixin</groupId>
+                            <artifactId>docker</artifactId>
+                            <version>${mavenmixin-docker.version}</version>
+                        </mixin>
                     </mixins>
                 </configuration>
             </plugin>
 
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-deploy-plugin</artifactId>
-                <configuration>
-                    <skip>true</skip>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>com.spotify</groupId>
-                <artifactId>docker-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>build-image</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>build</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>tag-image</id>
-                        <phase>install</phase>
-                        <goals>
-                            <goal>tag</goal>
-                        </goals>
-                        <configuration>
-                            <image>${docker-plugin.imageName}</image>
-                            <newName>${docker-plugin.imageName}:${project.version}</newName>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>push-image</id>
-                        <phase>deploy</phase>
-                        <goals>
-                            <goal>push</goal>
-                        </goals>
-                        <configuration>
-                            <imageName>${docker-plugin.imageName}:${project.version}</imageName>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>push-image-latest</id>
-                        <phase>deploy</phase>
-                        <goals>
-                            <goal>push</goal>
-                        </goals>
-                        <configuration>
-                            <imageName>${docker-plugin.imageName}:latest</imageName>
-                        </configuration>
-                    </execution>
-                </executions>
-                <configuration>
-                    <imageName>${docker-plugin.imageName}</imageName>
-                    <dockerDirectory>${build.outputDirectory}/docker</dockerDirectory>
-                    <resources>
-                        <resource>
-                            <targetPath>.</targetPath>
-                            <directory>${project.build.directory}</directory>
-                            <include>${docker-plugin.resource.include}</include>
-                        </resource>
-                    </resources>
-                    <serverId>${docker-plugin.serverId}</serverId>
-                    <registryUrl>${docker-plugin.registryUrl}</registryUrl>
-                </configuration>
-            </plugin>
-
-
         </plugins>
     </build>
 

http://git-wip-us.apache.org/repos/asf/isis/blob/735cb819/example/application/simpleapp/webapp/src/main/resources/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/resources/docker/Dockerfile b/example/application/simpleapp/webapp/src/main/resources/docker/Dockerfile
index eb975db..4c83be7 100644
--- a/example/application/simpleapp/webapp/src/main/resources/docker/Dockerfile
+++ b/example/application/simpleapp/webapp/src/main/resources/docker/Dockerfile
@@ -1,5 +1,4 @@
 FROM incodehq/tomcat
-MAINTAINER ${docker-plugin.maintainer}
 RUN rm -rf ${DEPLOYMENT_DIR}/ROOT
 COPY ${docker-plugin.resource.include} ${DEPLOYMENT_DIR}/ROOT.war
 EXPOSE 8080
\ No newline at end of file