Skip to content

Instantly share code, notes, and snippets.

@steventong
Last active July 25, 2019 03:23
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 steventong/800d2cdf93d5523f50a2d6e3f2d4810a to your computer and use it in GitHub Desktop.
Save steventong/800d2cdf93d5523f50a2d6e3f2d4810a to your computer and use it in GitHub Desktop.
maven-dockerfile-plugin
FROM openjdk:8-jdk
MAINTAINER Steven@CREAMS <wltong@creams.io>
# 设置时区
RUN ln -sf /usr/share/zoneinfo/Asia/ShangHai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata
ARG JAR_FILE
ADD target/${JAR_FILE} app.jar
ENV JVM_OPTS="-Xmx2048m"
ENV JAVA_OPTS=""
ENTRYPOINT [ "sh", "-c", "exec java $JVM_OPTS $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -XX:NativeMemoryTracking=summary -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/heap -verbose:gc -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -jar /app.jar" ]
<!-- https://github.com/spotify/dockerfile-maven -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.10</version>
<executions>
<execution>
<id>package-with-build-docker</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>creams/${project.artifactId}</repository>
<tag>latest</tag>
<dockerfile>Dockerfile</dockerfile>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment