COPY失败:在生成上下文中找不到文件,或者在Azure DevOps YAML管道中被.dokerignore排除



我使用经典编辑器管道创建了一个现有的Azure DevOps管道,以将.NET web API固定化,并使用helm图表部署到Kubernetes。

现在我正在为同样的内容创建一个全新的YAML管道
我遇到了一个问题。COPY指令无法将解决方案文件和nuget.config复制到WORKDIR。

我用过dockercontext,但运气不好
此外,我的Dockerfile和解决方案文件存在于后端-服务/服务/MaheshInstitue/MaheshInstitue.API 中

我的后端项目结构如下所示
后端-服务/服务/MaheshInstitue/MaheshInstitue.neneneba API
后台-服务/事务/LalithaInstitue/LalithaInstitue.API

错误消息:
步骤7/30:复制["Backend-Services/Services/MaheshInstitue/MaheshInstitue.neneneba API/MaheshManagement.API.csproj","Backend-Siervices/Services/MaheshInsttue/MaheshInstitue.nenenebc API/"]复制失败:在生成上下文中找不到文件或文件被排除。dockerignore:stat-Backend-Services/Services/MaheshInstitue/MaheshInstitue.API/MaheshManagement.API.csproj:文件不存在##[error]复制失败:在生成上下文中找不到文件或文件被排除。dockerignore:stat Backend-Services/Services/MaheshInstitue/MaheshInsttue.API/MaheshManagement.API.csproj:文件不存在##[error]进程"/usr/bin/docker"失败,退出代码为1

此外,我正在使用自托管代理来实现

此链接帮助我解决了问题Azure DevOps构建管道:复制失败:stat。。没有这样的文件或目录

尝试将Docker任务第34行的buildContext输入设置为$(Build.Repository.LocalPath(。如果您有多个repo,请尝试$(Pipeline.Workspace((参考:Azure Pipelines预定义变量(

当我在构建上下文文件夹结构时遇到问题时,有时我只是在开始时抛出一个小shell脚本来创建一些文件夹或运行树,这样我就可以看到结构。

最新更新