Docker Image Created using dockerfile-image-plugin
39
#Add this plugin code to pom.xml
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>spotify/foobar</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
Then execute mvn package command with sudo priviledges.
#Dockerfile code
#Getting the base Image to run the Applicaion FROM openjdk:8-jdk-alpine
#Providing the maintainer information MAINTAINER Suraj Ashok Bodade [email protected]
#Adding volume for the Container VOLUME /tmp
#Opening the ports for connection EXPOSE 8080
#Adding application war file to docker container ADD target/spring-boot-rest-example-2.0.6-SNAPSHOT.jar application.jar
#Need to Specify Entrypoint for the Container ENTRYPOINT ["java","-Dspring.profiles.active=test","-jar","/application.jar"]
Content type
Image
Digest
Size
69.5 MB
Last updated
almost 8 years ago
docker pull sunrays86/dockerfile-plugin-image:0.0.1-SNAPSHOT