Reputation: 784
I am using spotify's Docker maven plugin and want in to build two different images, one is a database (MariaDB) and the other is a Java EE image (Glassfish).
I have managed to get Maven to build the images OK when ran seperately however when I try and run both in the same POM file it will only create the first image.
I have tried putting two configuration sections within the single plugin and get the error below:
[ERROR] Non-parseable POM C:\Users\607819425\Documents\InteliJProjects\feature_docker\pom.xml: Duplicated tag: 'configuration' (position:START_TAG seen ...\r\n ... @300:32) @line 300, column 32 -> [Help 2]
Pom file with 2 configuration tags in one plugin
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.11</version>
<configuration>
<imageName>glassfish</imageName>
<dockerDirectory>glassfish</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<!-- copy the service's jar file from target into the root directory of the image -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
<configuration>
<imageName>mariadb</imageName>
<dockerDirectory>mariadb</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<!-- copy the service's jar file from target into the root directory of the image -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
And Also with two seperate plugins it only every builds the first image.
Two Plugin POM:
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.11</version>
<configuration>
<imageName>glassfish</imageName>
<dockerDirectory>glassfish</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<!-- copy the service's jar file from target into the root directory of the image -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.11</version>
<configuration>
<imageName>mariadb</imageName>
<dockerDirectory>mariadb</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<!-- copy the service's jar file from target into the root directory of the image -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
Any info you could give would be great!
Upvotes: 4
Views: 3776
Reputation: 784
I Switched to Fabric8.io's version of the plugin in the end as multiple images are supported.
Upvotes: 1