From f79627415e835ed2103fcf1dca313023e121dcde Mon Sep 17 00:00:00 2001 From: wanghongjian Date: Sun, 4 Feb 2024 00:23:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DockerFile | 19 +++++++++---------- README.md | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/DockerFile b/DockerFile index 9536719..283f3da 100644 --- a/DockerFile +++ b/DockerFile @@ -3,24 +3,23 @@ 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/ +ADD jdk-8u401-linux-x64.tar.gz /usr/local +ADD apache-tomcat-9.0.85.tar.gz /usr/local -ENV MYPATH /usr/local/ +ENV MYPATH /usr/local WORKDIR $MYPATH -ENV JAVA_HOME $MYPATH/jdk-8u401 +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 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"] - +VOLUME ["$TOMCAT_HOME/logs/","$TOMCAT_HOME/webapps"] # 注意:tail -F ,这里如果用小写的f,启动容器的时候打印完日志后会退出,用大写-F容器才会停留 -CMD $CATALINA_HOME/bin/startup.sh && tail -F $CATALINA_HOME/logs/catalina.out +CMD $TOMCAT_HOME/bin/startup.sh && tail -F $TOMCAT_HOME/logs/catalina.out diff --git a/README.md b/README.md index 8df6e22..3020466 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ``` shell docker build -f .\DockerFile -t tomcat-9-j8-centos . # 推送 -docker login macrocc.com:3000 -docker push gitea.example.com/marcrocc/tomcat-9-j8-centos:latest +docker tag tomcat-9-j8-centos:latest macrocc.com:3000/macrocc/tomcat-9-j8-centos:1.1.0 +docker push macrocc.com:3000/macrocc/tomcat-9-j8-centos:1.1.0 ```