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}

 

转载于:https://www.cnblogs.com/Jt00/p/8628346.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值