# vim Dockerfile FROM centos COPY ../README.md /usr/local/README.md # 会自动解压到指定目录,不需要人为去解压 ADD ../lib/jdk-8u401-linux-x64.tar.gz /usr/local ADD ../lib/apache-tomcat-9.0.85.tar.gz /usr/local ADD ../lib/opencv-4.9.0.sh /usr/local/opencv-4.9.0.sh ENV MYPATH /usr/local WORKDIR $MYPATH RUN mv jdk1.8.0_401/ java/ RUN mv apache-tomcat-9.0.85/ tomcat/ ENV JAVA_HOME $MYPATH/java ENV JAVA_VERSION jdk-8u401-linux-x64 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 PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin ENV OPENCV_VERSION: 4.9.0 # 执行opencv 代码 RUN /usr/local/opencv-4.9.0.sh EXPOSE 8080 VOLUME ["$TOMCAT_HOME/logs/","$TOMCAT_HOME/webapps"] # 注意:tail -F ,这里如果用小写的f,启动容器的时候打印完日志后会退出,用大写-F容器才会停留 CMD $TOMCAT_HOME/bin/startup.sh && tail -F $TOMCAT_HOME/logs/catalina.out