Skip to content

Instantly share code, notes, and snippets.

@gwokudasam
Created August 2, 2017 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwokudasam/94872c7456389852b3b6b7e0667a5f13 to your computer and use it in GitHub Desktop.
Save gwokudasam/94872c7456389852b3b6b7e0667a5f13 to your computer and use it in GitHub Desktop.
<profiles>
<profile>
<id>docker</id>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag-image</id>
<phase>install</phase>
<goals>
<goal>tag</goal>
<goal>push</goal>
</goals>
<configuration>
<image>enikolas/${project.artifactId}</image>
<newName>enikolas/${project.artifactId}</newName>
<imageName>enikolas/${project.artifactId}</imageName>
</configuration>
</execution>
</executions>
<configuration>
<baseImage>java:8-jre-alpine</baseImage>
<imageName>enikolas/${project.artifactId}</imageName>
<serverId>docker-hub</serverId>
<entryPoint>
["java", "-jar", "-Dspring.profiles.active=docker", "/${project.build.finalName}.jar"]
</entryPoint>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment