脚本宝典收集整理的这篇文章主要介绍了jib自定义entrypoint,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
序
本文主要研究一下jib自定义entrypoint的用场@H_777_4@
maven
<plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>jib-maven-plugin</artifactId> <version>0.9.10</version> <configuration> <container> <ports> <port>8080</port> </ports> <useCurrentTimestamp>true</useCurrentTimestamp> <entrypoint> <arg>/bin/sh</arg> <arg>-c</arg> <arg>java ${JAVA_OPTS} -cp /app/resources/:/app/classes/:/app/libs/* com.example.JibDemoApplication</arg> </entrypoint> </container> <from> <image>java:8u172-jre-alpine</image> </from> <to> <image>jib-demo:${maven.build.timestamp}</image> </to> <allowInsecureRegistries>true</allowInsecureRegistries> <extraDirectory>${project.basedir}/src/main/jib</extraDirectory> </configuration> </plugin>
"Entrypoint": [ "java", "-XMs512m", "-cp", "/app/resources/:/app/classes/:/app/libs/*", "com.example.JibDemoApplication" ]
这种模式貌似不能支持环境变量,因此需改为没有引号的模式,使用sh -c java命令来启动
运行
docker run -p 8080:8080 -e JAVA_OPTS='-Xms512m -Xmx512m' --rm jib-demo:20180903
这样就可以顺利使用JAVA_OPTS环境变量来配置JVM了
小结
jib的自定义entrypoint是0.9.10及以上版本才支持的,若需要自定义entrypoint,请先升级jib版本。
doc
以上是脚本宝典为你收集整理的jib自定义entrypoint全部内容,希望文章能够帮你解决jib自定义entrypoint所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。