docker tomcat镜像制作

1.新建一个目录放上相应的包

[root@k8s-api image]# ll
total 147772
-rw-r--r-- 1 root root 9037227 Mar 22 14:38 apache-tomcat-7.0.85.tar.gz
-rw-r--r-- 1 root root 22599 Mar 22 18:25 catalina.sh
-rw-r--r-- 1 root root 310 Mar 22 18:26 Dockerfile
drwxr-xr-x 8 10 143 233 Dec 19 2014 jdk1.7
-rw-r--r-- 1 root root 142249690 Mar 22 14:43 jdk-7u76-linux-x64.tar.gz
drwxr-xr-x 9 root root 160 Feb 7 20:55 tomcat7
[root@k8s-api image]#

[root@k8s-api image]# cat Dockerfile
FROM 192.168.19.111/baseimages/centos:6.9
MAINTAINER wenwst
RUN mkdir /opt/jdk
RUN mkdir /opt/tomcat7
COPY tomcat7 /opt/tomcat7
COPY catalina.sh /opt/tomcat7/bin/catalina.sh
COPY jdk1.7 /opt/jdk/jdk1.7
RUN chmod +x /opt/tomcat7/bin/catalina.sh
EXPOSE 8080 22
ENTRYPOINT ["/opt/tomcat7/bin/catalina.sh","run"]
[root@k8s-api image]#

Jenkins里面的配置:

cat >Dockerfile<<EOF
#FROM 192.168.19.111/baseimages/centos6.9-en-us:1.0
FROM 192.168.19.111/baseimages/tomcat7.856:latest
MAINTAINER wenwst@163.com
RUN sed -i '/OS specific support/a\JAVA_OPTS\=\"\-Xms4096m \-Xmx4096m \-XX\:PermSize\=256m \-XX\:MaxPermSize\=512m\"' /opt/tomcat7/bin/catalina.sh &&\
chmod +x /opt/tomcat7/bin/catalina.sh
ADD zhph_common_standalone.war /opt/tomcat7/webapps/
RUN mkdir /opt/tomcat7/webapps/${projectPkg%.war}
WORKDIR /opt/tomcat7/webapps/${projectPkg%.war}
RUN /opt/jdk/jdk1.7/bin/jar -xvf /opt/tomcat7/webapps/zhph_common_standalone.war
ENV JAVA_HOME /opt/jdk/jdk1.7
EXPOSE 8080
ENTRYPOINT ["/opt/tomcat7/bin/catalina.sh","run"]
EOF
/usr/bin/docker build -t ${image} ${WORKSPACE}/buildimage
echo '>>> Build Credit Platform Complete!'
echo '>>> Push image to AppHome!'
/usr/bin/docker push ${image}

 

posted on 2018-03-23 09:00  Jt00  阅读(194)  评论(0编辑  收藏  举报

导航