Dockerfile以及一些实例脚本

FROM ${docker.base.image.name} 
ENV LANG C.UTF-8
ENV TZ=Asia/Shanghai
#ENV JAVA_OPTS="-XX:PermSize=64M -XX:MaxPermSize=128m -Xms512m -Xmx1024m "
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD ./*.jar /usr/local/hcdata.jar  
#CMD ["catalina.sh", "run"]
ENTRYPOINT ["java","-jar","-Duser.timezone=GMT+8","/usr/local/hcdata.jar"]

 

一个创建dockerfile脚本及修改k8s镜像更新pod脚本示例

#!/bin/sh -ilex
/usr/bin/cp /usr/local/test/api/target/api.jar /jar/api/
cd /jar/api/
/usr/bin/cat > /jar/api/Dockerfile << EOF
FROM java:8
ADD api.jar /opt/api.jar
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ENTRYPOINT ["java","-jar","-Duser.timezone=GMT+8","/opt/api.jar"]
EOF

cd /jar/api/
datetime=`date +%m%d%H%M`
/usr/bin/docker build -t 10.10.49.40/lottery/api:$datetime . && echo "SUCCESS_INFO "镜像制作成功"" || echo "FAIL_INFO "镜像制作失败,请检查!""
/usr/bin/docker push 10.10.49.40/lottery/api:$datetime && echo -e "SUCCESS_INFO "推送镜像成功!"" || echo -e "\e[5;31mFAIL_INFO "push镜像失败,请检查!\e[m0""
kubectl patch deployment api --patch '{"spec": {"template": {"spec": {"containers": [{"name": "api","image":"10.10.49.40/lottery/api:'$datetime'"}]}}}}'
posted @ 2021-10-18 09:54  智杰  阅读(114)  评论(0编辑  收藏  举报
marquee
当你的才华还撑不起你的野心的时候,你就应该静下心来学习。当你的能力还驾驭不了你的目标的时候,你就应该沉下心来历练。问问自己,想要怎样的人生