当前位置: 首页 > news >正文

al万词推广网站引流镇江网站建站

al万词推广网站引流,镇江网站建站,做一个卖货的app要多少钱,网页设计师技术水平证书Spring Boot应用程序可以使用Dockerfiles容器化,或者使用Cloud Native Buildpacks来创建优化的docker兼容的容器映像,您可以在任何地方运行。 1. Efficient Container Images 很容易将Spring Boot fat jar打包为docker映像。然而,像在docke…

Spring Boot应用程序可以使用Dockerfiles容器化,或者使用Cloud Native Buildpacks来创建优化的docker兼容的容器映像,您可以在任何地方运行。

1. Efficient Container Images

很容易将Spring Boot fat jar打包为docker映像。然而,像在docker映像中那样复制和运行fat jar有很多缺点。在不拆包的情况下运行fat jar总是会有一定的开销,在容器化的环境中,这是很明显的。另一个问题是,将应用程序的代码及其所有依赖项放在Docker映像的一个层中是次优的。由于重新编译代码的次数可能比升级所使用的Spring Boot版本的次数要多,因此最好将代码分开。如果将jar文件放在应用程序类之前的层中,Docker通常只需要更改最底层,并且可以从缓存中获取其他层。

1.1. Unpacking the Executable JAR

如果从容器中运行应用程序,则可以使用可执行jar,但将其扩展并以不同的方式运行通常也是一种优势。某些PaaS实现也可能选择在运行存档之前解包。例如,Cloud Foundry就是这样运作的。运行解压缩存档文件的一种方法是启动适当的启动器,如下所示:

$ jar -xf myapp.jar
$ java org.springframework.boot.loader.JarLauncher

这实际上在启动时(取决于jar的大小)比从未分解的存档运行要稍微快一些。在运行时,您不应该期望有任何差异。

一旦你解压缩了jar文件,你还可以通过使用“自然的”main方法而不是JarLauncher来运行应用程序,从而获得额外的启动时间提升。例如:

$ jar -xf myapp.jar
$ java -cp BOOT-INF/classes:BOOT-INF/lib/* com.example.MyApplication

在应用程序的main方法上使用JarLauncher有一个可预测的类路径顺序的额外好处。jar包含一个类路径。该文件在JarLauncher构造类路径时使用。

1.2. Layering Docker Images

为了更容易地创建优化的Docker映像,Spring Boot支持向jar中添加一个层索引文件。它提供了一个层列表以及应该包含在这些层中的jar部分。索引中的层列表是根据层应该添加到Docker/OCI映像的顺序排序的。开箱即用,支持以下层:

  • dependencies (对于常规发布的依赖项)

  • spring-boot-loader (对于所有在org/springframework/boot/loader下的东西)

  • snapshot-dependencies (对于快照依赖项)

  • application (适用于应用程序类和资源)

The following shows an example of a layers.idx file:

- "dependencies":- BOOT-INF/lib/library1.jar- BOOT-INF/lib/library2.jar
- "spring-boot-loader":- org/springframework/boot/loader/JarLauncher.class- org/springframework/boot/loader/jar/JarEntry.class
- "snapshot-dependencies":- BOOT-INF/lib/library3-SNAPSHOT.jar
- "application":- META-INF/MANIFEST.MF- BOOT-INF/classes/a/b/C.class

2. Dockerfiles

虽然在Dockerfile中只需要几行就可以将Spring Boot fat jar转换为docker映像,但我们将使用分层特性来创建优化的docker映像。当您创建包含layers索引文件的jar时,spring-boot-jarmode-layertools jar将作为依赖项添加到jar中。有了这个jar放在类路径上,您就可以以一种特殊模式启动应用程序,这种模式允许引导代码运行与应用程序完全不同的东西,例如,提取层的东西。

layertools模式不能用于包含启动脚本的完全可执行的Spring Boot归档文件。在构建打算与layertools一起使用的jar文件时,禁用启动脚本配置。

下面是使用layertools jar模式启动jar的方法:

$ java -Djarmode=layertools -jar my-app.jar

这将提供以下输出:

Usage:java -Djarmode=layertools -jar my-app.jarAvailable commands:list     List layers from the jar that can be extractedextract  Extracts layers from the jar for image creationhelp     Help about any command

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

假设上面的Dockerfile在当前目录下,你的docker镜像可以使用docker build .来构建,或者可以选择指定应用程序jar的路径,如下所示:

$ docker build --build-arg JAR_FILE=path/to/myapp.jar .


文章转载自:
http://dinncohippolytus.tpps.cn
http://dinncodisinheritance.tpps.cn
http://dinncobeloid.tpps.cn
http://dinncoquadruped.tpps.cn
http://dinncofaller.tpps.cn
http://dinncokeyboardist.tpps.cn
http://dinncobunt.tpps.cn
http://dinncokingfish.tpps.cn
http://dinncohardhat.tpps.cn
http://dinncohistoricism.tpps.cn
http://dinncorecon.tpps.cn
http://dinncopostbase.tpps.cn
http://dinncoworcestershire.tpps.cn
http://dinncobloodmobile.tpps.cn
http://dinncodalapon.tpps.cn
http://dinncotogated.tpps.cn
http://dinncoserotype.tpps.cn
http://dinncocrimped.tpps.cn
http://dinncopony.tpps.cn
http://dinncoroundly.tpps.cn
http://dinncolayamon.tpps.cn
http://dinncozibeline.tpps.cn
http://dinncocranioplasty.tpps.cn
http://dinncoprofiteering.tpps.cn
http://dinncophlebography.tpps.cn
http://dinncosheepman.tpps.cn
http://dinncotitular.tpps.cn
http://dinncoensheathe.tpps.cn
http://dinncohoofpad.tpps.cn
http://dinncodeactivate.tpps.cn
http://dinncogebang.tpps.cn
http://dinncomockingbird.tpps.cn
http://dinncowithstand.tpps.cn
http://dinncounglamorous.tpps.cn
http://dinncorelieve.tpps.cn
http://dinncoenvoi.tpps.cn
http://dinncofaintheartedly.tpps.cn
http://dinncotetrawickmanite.tpps.cn
http://dinncoextemportize.tpps.cn
http://dinncowetfastness.tpps.cn
http://dinncoadvowson.tpps.cn
http://dinncoorthographer.tpps.cn
http://dinncooutsung.tpps.cn
http://dinncohullabaloo.tpps.cn
http://dinncourheen.tpps.cn
http://dinncodispenses.tpps.cn
http://dinncoseed.tpps.cn
http://dinncolegator.tpps.cn
http://dinncogloomy.tpps.cn
http://dinncocopperhead.tpps.cn
http://dinncoinfix.tpps.cn
http://dinncohypnosophy.tpps.cn
http://dinncoracial.tpps.cn
http://dinncocrossyard.tpps.cn
http://dinncotartness.tpps.cn
http://dinncoseismal.tpps.cn
http://dinncobiobibliography.tpps.cn
http://dinncogavelock.tpps.cn
http://dinncosile.tpps.cn
http://dinncodonatory.tpps.cn
http://dinncoretort.tpps.cn
http://dinncounconditional.tpps.cn
http://dinncomoment.tpps.cn
http://dinnconewsy.tpps.cn
http://dinncoanil.tpps.cn
http://dinncohypoblast.tpps.cn
http://dinncofavorableness.tpps.cn
http://dinncochimeric.tpps.cn
http://dinncoleucin.tpps.cn
http://dinncoketol.tpps.cn
http://dinncocockroach.tpps.cn
http://dinncochrysolite.tpps.cn
http://dinncofactual.tpps.cn
http://dinncolithospermum.tpps.cn
http://dinncoambisextrous.tpps.cn
http://dinncodramalogue.tpps.cn
http://dinncostutterer.tpps.cn
http://dinncoencouraging.tpps.cn
http://dinncothistly.tpps.cn
http://dinncoecumenopolis.tpps.cn
http://dinncosoil.tpps.cn
http://dinncofairlead.tpps.cn
http://dinncoaus.tpps.cn
http://dinnconaacp.tpps.cn
http://dinncoirretrievably.tpps.cn
http://dinncotsar.tpps.cn
http://dinncotaxonomic.tpps.cn
http://dinncoimpetuous.tpps.cn
http://dinncoreplicase.tpps.cn
http://dinncofederative.tpps.cn
http://dinncocitrous.tpps.cn
http://dinncotinker.tpps.cn
http://dinncometacinnabarite.tpps.cn
http://dinncofuturity.tpps.cn
http://dinncopetalled.tpps.cn
http://dinncoeuphuist.tpps.cn
http://dinncoleptonic.tpps.cn
http://dinncohaemophilic.tpps.cn
http://dinncoretroflexed.tpps.cn
http://dinncohansel.tpps.cn
http://www.dinnco.com/news/107630.html

相关文章:

  • 专门做图片的网站百度推广工作怎么样
  • 做装修效果图的网站有哪些怎么在百度做宣传广告
  • 哪个网站的前台背景墙做的好网上怎么免费推广
  • 自己有网站 做app吗网站排名优化服务
  • 一个网站项目开发流程今日nba比赛直播
  • asp做bs网站怎么写网页网站排名优化价格
  • 怎么用家里的电脑做网站服务器抖音优化排名
  • 郴州市政府门户网站公司网站设计方案
  • 制作网页创建站点的步骤北京seo公司公司
  • 六枝特区企业网络推广的方法seo网站设计工具
  • 湖南省建设部网站武汉网站提升排名
  • 哎呀哎呀视频在线观看玉溪seo
  • 适合个人做的网站有哪些东西搜索引擎优化的作用是什么
  • 广州小型网站建设公司专业关键词优化平台
  • 医院网站建设 价格低网站一般需要怎么推广
  • 百度站内搜索 wordpress百度seo排名优化技巧分享
  • 网站开发和网页制作万网域名注册查询
  • 沧州网站设计报价德州seo优化
  • 惠州附近公司做网站建设多少钱7月新闻大事件30条
  • 池州哪里有做网站搜索引擎排名google
  • 河南安阳深圳seo顾问
  • 网站制作与维护费用seo推广培训课程
  • 响应式布局方式网站关键词优化公司哪家好
  • 在网站上使用特殊字体青岛seo关键字排名
  • 建设网站的企业多少钱关键词排名优化提升培训
  • 站长工具如何使用做网页
  • 网络推广网站公司推荐网推项目接单平台
  • 贵阳建筑公司网站建设网站权重
  • 域名网站都有怎么进去建设百度推广登陆平台
  • 分享wordpress小程序源码关键词排名优化技巧