tomcat8-jdk8-centos-docker/DockerFile

27 lines
919 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# vim Dockerfile
FROM centos
COPY README.md /usr/local/README.md
# 会自动解压到指定目录,不需要人为去解压
ADD jdk-8u401-linux-x64.tar.gz /usr/local/
ADD apache-tomcat-9.0.85.tar.gz /usr/local/
ENV MYPATH /usr/local/
WORKDIR $MYPATH
ENV JAVA_HOME $MYPATH/jdk-8u401
ENV TOMCAT_HOME $MYPATH/tomcat
ENV TOMCAT_VERSION apache-tomcat-9.0.85
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV CATALINA_HOME $TOMCAT_HOME
ENV CATALINA_BASH $TOMCAT_HOME
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin
EXPOSE 8080
VOLUME ["$CATALINA_HOME/logs/","$CATALINA_HOME/webapps"]
#VOLUME ["/usr/local/apache-tomcat-9.0.54/logs/","/usr/local/apache-tomcat-9.0.54/webapps"]
# 注意tail -F ,这里如果用小写的f启动容器的时候打印完日志后会退出用大写-F容器才会停留
CMD $CATALINA_HOME/bin/startup.sh && tail -F $CATALINA_HOME/logs/catalina.out