給 springboot專案執行環境製作Dockerfile映象
阿新 • • 發佈:2018-12-26
1、基於ubuntu 的映象($app 此處為佔位符號,替換為自己的spring boot 專案的jar)
FROM ubuntu:16.04
MAINTAINER modian(744955753@qq.com)
ADD jdk-8u151-linux-x64.tar.gz /usr/local/jdk8
ENV JAVA_HOME /usr/local/jdk8/jdk1.8.0_151
ENV JRE_HOME $JAVA_HOME/jre
ENV CLASSPATH :$JAVA_HOME/lib:$JRE_HOME/lib
ENV PATH $PATH:$JAVA_HOME/bin
ARG appADD $app
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
2、基於已有的java8映象進行spring boot映象製作 (pbplatform-example-1.0.jar 佔位符)
FROM java:8
VOLUME /tmp
ARG JAR_FILE
ADD pbplatform-example-1.0.jar app.jar
RUN bash -c 'touch /app.jar'
EXPOSE 8800
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","-Denv=DEV","/app.jar"]