简体   繁体   English

使用VSTS构建Linux C ++

[英]Building Linux C++ with VSTS

I'm trying to build a C++ app for Linux using VSTS. 我正在尝试使用VSTS为Linux构建C ++应用程序。 The build is defined by the Docker container template, and the Agent queue is Hosted Linux. 构建是由Docker容器模板定义的,并且代理队列是Hosted Linux。

When running, I get [error]Unhandled: No Docker file matching /opt/vsts/work/1/s/**/Dockerfile was found. 运行时,出现[错误]未处理:找不到与/ opt / vsts / work / 1 / s / ** / Dockerfile匹配的Docker文件。

How do I create the Docker file requested by the error message? 如何创建错误消息请求的Docker文件?

The error means that there isn't the Dockerfile file existing in working folder, you can include the Dockerfile file in the source control and map to the agent (Get sources of build definition) 该错误意味着工作文件夹中不存在Dockerfile文件,您可以将Dockerfile文件包含在源代码管理中并映射到代理(获取构建定义的源代码)

There is the Docker image that shared by others, for example: madduci/docker-ubuntu-cpp and the CMake generated files will be in build folder, if you just need to build the C++ project, you can refer to these steps (CMakeLists.txt is in the root of the repository): 有一个由其他人共享的Docker映像,例如: madduci / docker-ubuntu-cpp ,并且CMake生成的文件将位于build文件夹中,如果您只需要构建C ++项目,则可以参考以下步骤(CMakeLists。 txt在存储库的根目录中):

  1. Add Docker task (Action: Run a Docker command ; Command: run -v $(Build.SourcesDirectory):/project madduci/docker-ubuntu-cpp ) 添加Docker任务(操作: Run a Docker command ;命令: run -v $(Build.SourcesDirectory):/project madduci/docker-ubuntu-cpp
  2. Publish Build Artifacts (Path to publish: $(Build.SourcesDirectory)/build ) 发布构建工件(发布路径: $(Build.SourcesDirectory)/build

If you need to build the docker image, you need to create Dockerfile. 如果需要构建Docker映像,则需要创建Dockerfile。

When the Docker task is set to Build an image you get an option to specify a Docker file: 当Docker任务设置为Build an image时,您将获得一个指定Docker文件的选项:

用于构建映像的Docker文件

**/Dockerfile means that the task will search your repository for a file named Dockerfile and use that to build the image. **/Dockerfile表示该任务将在您的存储库中搜索名为Dockerfile的文件,并使用该文件来构建映像。

The error you get means that this file can't be found. 您收到的错误意味着找不到该文件。 You can find some examples of Dockerfiles here in the Docker documentation . 您可以在Docker文档中找到一些Dockerfile的示例。 This blog describes how to build C++ applications that run on a Linux container 该博客描述了如何构建在Linux容器上运行的C ++应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM