我应该在Docker映像中编译我的应用程序吗 [英] Should I Compile My Application Inside of a Docker Image

查看:186
本文介绍了我应该在Docker映像中编译我的应用程序吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管大多数时候我都是在开发Java应用程序,而只是在使用Maven,所以我的构建应该是可复制的(至少那是Maven所说的)。

Although most of the time I am developing Java apps and am simply using Maven so my builds should be reproducible (at least that's what Maven says).

但是,如果您正在编译C ++程序或更多内容,是否应该在docker内部构建?

还是理想地使用vagrant或其他工具技术来产生可复制的构建。

But say you are compiling a C++ program or something a little more involved, should you build inside of docker?
Or ideally use vagrant or another technology to produce reproduce able builds.

如何使用docker管理可复制的构建?

How do you manage reproducible build with docker?

推荐答案

您可以,但不能在最终图像中显示,因为这将意味着图像比实际需要大得多:它将包括所有编译工具,而不仅限于您需要执行的内容 生成的二进制文件。

You can, but not in your final image, as that would mean a much larger image than necessary: it would include all the compilation tool, instead of limiting to only what you need to execute the resulting binary.

您可以在 如何做我为没有构建工具的Ruby项目构建了Docker映像?


  • 我使用映像进行构建,

  • 我将生成的停止容器作为新映像提交(卷中包含生成的二进制文件)

  • 我使用执行映像(一个仅包含您所执行的映像)需要运行),然后复制b其他图片的inary。我再次提交生成的容器。

最终映像包括编译后的二进制文件和执行环境。

The final image includes the compiled binary and the execution environment.

这篇关于我应该在Docker映像中编译我的应用程序吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆