Docker maven plugin - including a zip in the assembly

809 views
Skip to first unread message

Warren Strange

unread,
Feb 8, 2017, 11:30:56 AM2/8/17
to fabric8

I am struggling to understand the DMP, and how to get it to include a zip or tar archive.

We have a relatively complex app structure that is assembled as a zip or tar archive with another maven pom. This is installed as a maven artifact in our repo.

I want to have that zip expanded in the docker image (say under /opt, but /maven would work fine as well).

The assembly descriptor never matches the artifact pattern:



<assembly>
<inline>
<dependencySets>
<dependencySet>
<includes>
<include>org.acme.microservice.auth:authn-zip:zip:${project.version}</include>
</includes>
<outputDirectory>.</outputDirectory>
</dependencySet>
</dependencySets>
</inline>
</assembly>



If I run a mvn docker:build, I see:

WARNING] Cannot include project artifact: org.acme.microservice.authn:authn-docker:pom:1.0.0-SNAPSHOT; it doesn't have an associated file or directory.
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'org.acme.microservice.auth:authn-zip:zip:1.0.0-SNAPSHOT'

I am probably doing it wrong. 

Suggestions are welcome!!


Roland Huss

unread,
Feb 8, 2017, 12:16:59 PM2/8/17
to Warren Strange, fabric8
Could you try to use a `mvn package docker:build` and verify that this include is indeed a dependency in your pom.xml (within <dependencies>) ? BTW, which version of d-m-p are you using ?

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
... roland

Warren Strange

unread,
Feb 8, 2017, 12:41:08 PM2/8/17
to fabric8, warren....@gmail.com

Hi Roland

I tried that, but I get the same result. 

I do have a dependency on the zip in my pom.

If try to use one of the pre-defined assembly descriptors (artifact-with-dependencies) the zip does get added to the docker image, along with a bunch of other transitive dependencies that I don't want.   The zip is put in the docker image,  but is  not expanded - which is what I want.

I am using 0.19.0

Roland Huss

unread,
Feb 8, 2017, 12:47:09 PM2/8/17
to Warren Strange, fabric8
You can look at the predefined descriptors directly and copy over the parts you need: https://github.com/fabric8io/docker-maven-plugin/tree/master/src/main/resources/assemblies But I'm afraid its not possible to directly expand the zip archive with d-m-p. 

However with some Maven Fu you probably can use the maven-dependency-plugin (https://maven.apache.org/plugins/maven-dependency-plugin/unpack-mojo.html), unpack the archive into `target/` and then use a <fileSet> in the assembly to add this content.

... roland

Warren Strange

unread,
Feb 8, 2017, 12:56:30 PM2/8/17
to fabric8, warren....@gmail.com

Thanks Roland - I will give the maven dep plugin a shot
Reply all
Reply to author
Forward
0 new messages