Skip to content

Commit

Permalink
Initial building of containers from Maven, see IQSS#5292
Browse files Browse the repository at this point in the history
This commit adds initial support for building an "application only" container.
That is achived by adding the fabric8io/docker-maven-plugin to a new
Maven profile called "container". Build via `mvn docker:build`.

The build is based on the upstream Payara 5 image right now. This is a TODO,
as the upstream container project is not very responsive and there is no
proper signal handling in place.
  • Loading branch information
poikilotherm committed Dec 10, 2018
1 parent b655f50 commit b9e520d
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 1 deletion.
1 change: 0 additions & 1 deletion Dockerfile

This file was deleted.

7 changes: 7 additions & 0 deletions conf/docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM payara/server-full:latest

ARG LIB_PATH="${PAYARA_DIR}/glassfish/domains/${DOMAIN_NAME}/lib/"

COPY --chown=payara maven/lib/* ${LIB_PATH}

COPY maven/${project.build.finalName}.war ${DEPLOY_DIR}
89 changes: 89 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -716,5 +716,94 @@
<id>all-unit-tests</id>
</profile>
<!-- TODO: Add a profile to run API tests (integration tests that end in IT.java. See conf/docker-aio/run-test-suite.sh -->
<profile>
<id>container</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<attachClasses>true</attachClasses>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<!-- Build docker images (defaults to "install" phase) -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.27.1</version>

<configuration>
<images>
<!-- application -->
<image>
<alias>dv</alias>
<name>iqss/dataverse:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/conf/docker/app</dockerFileDir>
<assembly>
<inline>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<!-- copy the WAR artifact -->
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<includes>
<include>${project.groupId}:${project.artifactId}</include>
</includes>
<outputFileNameMapping>${project.build.finalName}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
<!-- copy dependencies to maven/lib folder -->
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<scope>runtime</scope>
<fileMode>0644</fileMode>
</dependencySet>
</dependencySets>
</inline>
</assembly>
</build>
</image>
<!-- database -->
<!-- solr -->
</images>
</configuration>

<!-- Connect start/stop to pre- and
post-integration-test phase, respectively if you want to start
your docker containers during integration tests -->
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<!-- "build" should be used to create the images with the
artifact -->
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit b9e520d

Please sign in to comment.