fabric8io docker-maven-plugin assembly and external artifact

I am trying to create a docker image from within maven which includes artifacts from a different maven project. But the examples I have copied do not appear to be working.

I think the problem here is I do not really understand how assemblies work and so am asking for help on what I want to do here. I have set up a contrived simple example of what I am trying to do here:



So my project has two modules:

  • sod-java which builds an executable jar (which just writes a file to /tmp/sod.txt)
  • sod-docker which creates a java alpine image with Dockerfile
    • setup.sh is run when building the image. It runs the java to create the /tmp/sod.txt
    • run.sh is the default command writes the content of the /tmp/sod.txt file

I have tried two approaches to the inline <assembly> so far:

In both cases I do not see the jar file copied anywhere by the assembly or in the tar file which the docker plugin creates and so I get an error when attempting to reference the jar in a Dockerfile COPY command.

I know the example is a bit contrived. But its simple and fitting with the standard way we do things at work. So I do not have a lot of flexibility in respect to tools, layouts etc.

The real case is used to build database images. Get base image, run java code to manipulate database, save as new image to be used downstream.

How can I specify a groupId, artifactId, version and have the corresponding artifact included in my docker image. The docker source itself contains no java.

Source: StackOverflow