2019独角兽企业重金招聘Python工程师标准>>>
FROM centos:7
ENV JAVA_HOME /usr/java/jdk1.7.0_55
ENV MAC_PUBLISH_PATH /home/app
ENV LOG_PATH /var/log
ENV PATH $JAVA_HOME/bin:$PATH
ENV TIME_ZONE Asia/Shanghai
COPY jdk-7u55-linux-x64.rpm /opt/
RUN mkdir -p $MAC_PUBLISH_PATH && mkdir -p "$LOG_PATH" && rpm -ih /opt/jdk-7u55-linux-x64.rpm \
&& 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 镜像标签 路径