Skip to main content

Dockerfile 配置模板


FROM openjdk:8
VOLUME /tmp
# EXPOSE 80
ENV TZ=Asia/Shanghai JAVA_OPTS=-Xmx512m
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD *.jar app.jar
ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar
# ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar --Dspring.config.location=/config/*
# 为了缩短 Tomcat 的启动时间,添加java.security.egd的系统属性指向/dev/urandom作为 ENTRYPOINT
ENTRYPOINT ['java', $JAVA_OPTS, '-Djava.security.egd=file:/dev/./urandom','-jar', '/app.jar', '--Dspring.config.location=/config/*']

FROM java:8
VOLUME /tmp
EXPOSE 8080
ENV TZ=Asia/Shanghai JAVA_OPTS=-Xmx512m
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD *.jar app.jar
ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar

# 
FROM openjdk:11
VOLUME /tmp
ENV TZ=Asia/Shanghai JAVA_OPTS=-Xmx512m
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD *.jar app.jar
# CMD echo '10.254.7.7 bzdts.chinaetc.org' >> /etc/hosts; java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar --Dspring.config.location=/config/*
ENTRYPOINT echo '10.254.7.7 bzdts.chinaetc.org' >> /etc/hosts && java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar --Dspring.config.location=/config/*


# tomcat_8.5.47-jdk11
FROM tomcat:8.5.47-jdk11
# MAINTAINER itqmdx@gmail.com
# VOLUME /usr/local/tomcat
EXPOSE 8080
# RUN rm -rf /usr/local/tomcat/webapps/*
ENV TZ=Asia/Shanghai JAVA_OPTS=-Xmx512m
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# ADD ./target/* /usr/local/tomcat/webapps/
ENTRYPOINT ['/usr/local/tomcat/bin/catalina.sh', 'run']
# ENTRYPOINT echo '10.254.7.7 bzdts.chinaetc.org' >> /etc/hosts && /usr/local/tomcat/bin/catalina.sh run