Docker setting

This commit is contained in:
crusader 2017-07-31 11:27:39 +09:00
parent 776503b347
commit 5b56acf72b
3 changed files with 54 additions and 30 deletions

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM openjdk:8-jdk-alpine
MAINTAINER Loafle <rnd@loafle.com>
ADD target/lib /service/lib
ADD target/com.loafle.overflow.overflow_server.jar /service/
ENTRYPOINT ["/usr/bin/java", "-jar", "/service/com.loafle.overflow.overflow_server.jar"]

76
pom.xml
View File

@ -150,6 +150,23 @@
</extensions>
<plugins>
<!-- Copy Maven dependencies into target/lib/ -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<overWriteReleases>false</overWriteReleases>
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
@ -201,37 +218,38 @@
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<imageName>docker.loafle.net/overflow/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<!-- optionally overwrite tags every time image is built with docker:build -->
<forceTags>true</forceTags>
<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>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
<executions>
<execution>
<id>build</id>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag</id>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<repository>docker.loafle.net/overflow/${project.build.finalName}</repository>
<tag>${project.version}</tag>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-assembly-plugin</artifactId>-->
<!--<version>2.2.1</version>-->
<!--<configuration>-->
<!--<descriptorRefs>-->
<!--<descriptorRef>jar-with-dependencies</descriptorRef>-->
<!--</descriptorRefs>-->
<!--</configuration>-->
<!--</plugin>-->
</plugins>
</build>

View File

@ -1 +0,0 @@
FROM openjdk:8-jdk-alpine