【发布时间】:2016-08-06 23:17:40
【问题描述】:
我想设置一个 Docker 容器来支持完全用 C++ 编写的代码库的构建,并且生成的应用程序只能在 Windows 上运行。
为此,我需要设置一个容器来复制我们当前的构建环境以支持构建。
我需要创建一个类似下面的 Dockerfile 来构建这样的容器:
请将以下内容视为一种伪代码 Dockerfile(忽略 apt-get 并考虑 Windows 中的任何其他实用程序从命令行安装工具):
FROM: Windows10 // A base windows kernel
RUN apt-get install -y VisualStudio // Installing the Visual Studio for compilation of C++ files
RUN apt-get install -y cygwin // Since I am using some cygwin utlities in build process
RUN apt-get install -y SigningTool // A tool I need to sign the exe
RUN apt-get install -y CompressionTool // A tool I need to compress the exe
RUN apt-get install -y BuildSystem // Custom in-house build system to generate the builds of the source code
CMD ['BuildSystem debug']
注意:我们的组织中有一个自定义构建系统(并且不使用 GNU Make)来执行构建。 debug 是提供给构建系统的目标,因为我想构建一个调试可执行文件。
我的疑问是:
如何安装 VisualStudio 编译器(或在 Windows 上运行的任何其他编译器)
我如何托管 SigningTool、CompressionTool 和其他可执行文件(在 Docker Trusted Registry 上;是否可以托管DTR 上的可执行文件)
我该如何处理上述工具(编译器、签名工具、压缩工具都需要许可证才能运行)的许可。
以上在我们的组织中工作得很好。 但是设置机器的过程(安装和上述所有工具需要花费大量时间和精力)。 因此,我想创建一个可以部署在裸机上的 Docker 镜像,它可以在很短的时间内完成整个构建环境的设置和运行。
这样做的一个更重要的目的是采用持续交付方法。
请提供您的意见(尝试考虑所有疑问)。
【问题讨论】:
标签: c++ windows visual-studio docker dockerfile