如何建立一份springboot的docker鏡像

FROM centos:7java

 

ENV JAVA_HOME /usr/java/jdk1.7.0_55linux

ENV MAC_PUBLISH_PATH /home/appspring

 

ENV LOG_PATH /var/logdocker

 

ENV PATH $JAVA_HOME/bin:$PATHcentos

ENV  TIME_ZONE Asia/Shanghaiapp

COPY jdk-7u55-linux-x64.rpm /opt/spring-boot

 

RUN mkdir -p $MAC_PUBLISH_PATH && mkdir -p "$LOG_PATH" && rpm -ih /opt/jdk-7u55-linux-x64.rpm \ui

&& rm -rf /opt/jdk-7u55-linux-x64.rpm資源

 

COPY spring-boot-xxx-ap一p-0.0.1-SNAPSHOT.jar $MAC_PUBLISH_PATH模板

 

COPY config $MAC_PUBLISH_PATH/config

 

WORKDIR $MAC_PUBLISH_PATH

 

RUN set -xe \

&& chown -R 1000:1000 "$MAC_PUBLISH_PATH" \
&& chown -R 1000:1000 "$LOG_PATH" \
&& echo "${TIME_ZONE}" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime

 

EXPOSE 8090

 

VOLUME $LOG_PATH

VOLUME /$MAC_PUBLISH_PATH/config

ENV LANG en_US.UTF-8

CMD ["java","-jar","/home/app/spring-boot-xxx-app-0.0.1-SNAPSHOT.jar"]

以上是Dockerfile一個很好的模板,全部資源文件必須跟Dockerfile在同一文件夾。最後輸入命令docker build -t 鏡像標籤 路徑

相關文章
相關標籤/搜索