I am very new to Docker and the fabric8io docker-maven-plugin. I am having some hard times to deploy a .war into my image derived by the jboss/wildfly one. I can succesful build my image shipped with .war by command line but I can't do the same by the already mentioned plugin.
As far as I read, once you give right context and Dockerfile it should be only a matter of:
<build>
<finalName>${project.build.finalName}.${project.packaging}</finalName>
...
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</build>
but I am gettin this error:
[INFO] <<< docker-maven-plugin:0.19.0:build (default-cli) < package @ YoOffer <<<
[INFO]
[INFO] --- docker-maven-plugin:0.19.0:build (default-cli) @ YoOffer ---
[WARNING] Cannot include project artifact: edu.pezzati.yo:YoOffer:war:0.0.1-SNAPSHOT; it doesn't have an associated file or directory.
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o 'edu.pezzati.yo:YoOffer'
[ERROR] DOCKER> Failed to create assembly for docker image (with mode 'dir'): Error creating assembly archive docker: You must set at least one file.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Here is my sandbox.
UPDATE: I clean up some mess in my pom. Now it looks like this:
<images>
<image>
<alias>yowildfly</alias>
<name>jboss/wildfly</name>
<build>
<!--
<assembly>
<descriptorRef>${project.basedir}/src/test/resources/DOCKER/assembly.xml</descriptorRef>
</assembly>
-->
<args>
<webapp>target/${project.build.finalName}.${project.packaging}</webapp>
</args>
<dockerFileDir>${project.basedir}</dockerFileDir>
<dockerFile>src/test/resources/DOCKER/wildfly/Dockerfile</dockerFile>
</build>
<run>
<ports>
<port>8080:8080</port>
</ports>
</run>
</image>
...
</images>
Now I am getting this error:
...
[ERROR] DOCKER> Unable to build image [jboss/wildfly]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.769 s
[INFO] Finished at: 2017-02-12T01:19:57+01:00
[INFO] Final Memory: 36M/271M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.19.0:build (default-cli) on project YoOffer: Unable to build image [jboss/wildfly]: lstat target/YoOffer.war: no such file or directory -> [Help 1]
[ERROR]
...
Accordingly to docs, dockerFileDir used together with dockerFile should mark image build context.
I misunderstood fabric8io docker plugin docs. You can use together
dockerFileDiranddockerFilebut building context won't be set todockerFileDirvalue. To deploy my artifact fromtargetI have to put myDockerfileto the root of my project, setdockerFileDirvalue with project root path, remove thedockerFileentry from mypom. My sandbox is updated this way. Next step is to achieve the same in a cleaner way by usingassemblyinbuildconf.