Azure管道:Docker buildAndPush失败
我有一个通用管道将docker图像保存到AWS ERC,如下所示:Azure管道:Docker buildAndPush失败,docker,azure-devops,azure-pipelines,azure-pipelines-release-pipeline,azure-devops-self-hosted-agent,Docker,Azure Devops,Azure Pipelines,Azure Pipelines Release Pipeline,Azure Devops Self Hosted Agent,我有一个通用管道将docker图像保存到AWS ERC,如下所示: # ASP.NET Core (.NET Framework) # Build and test ASP.NET Core projects targeting the full .NET Framework. # Add steps that publish symbols, save build artifacts, and more: # https://docs.microsoft.com/azure/devops/pi
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
name: Default
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
displayName: 'NuGetToolInstaller'
- task: NuGetCommand@2
displayName: 'NuGetCommand'
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: 'Building Applicaton'
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
displayName: 'Running Test'
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(buildConfiguration) -o $(build.StagingDirectory)/cd-build --no-build'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Docker@2
inputs:
containerRegistry: 'ECR Connection'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
我已在我的系统(powershell)上设置了托管代理。我已经建立了AWS和Docker服务连接,但它以一种奇怪的方式失败了。。。这是Docker日志(我已更改项目以隐藏我的真实姓名和公司信息):
当我查找它说丢失的文件时,我在代理文件夹C:\Users\me\AzureDevOps\agent\u work\3\s\MyAPI\API\Web.API.csproj中找到了它
查看日志,docker正试图从/var/lib/docker/tmp/docker-builder654845578/API/Web.API.csproj复制它
也许我把docker任务的设置搞砸了,没有在代理上提供正确的位置(老实说,docker任务中没有放置文件夹信息的位置)?评论/想法?我已经解决了这个问题。的默认值Docker任务模板中的生成上下文是
**
。我必须将git项目的值更改为根文件夹值。
i、 e.文件夹结构
APIRootName
- MyAPI
- API
- Dockerfile
Another folder representation: APIRootName\MyAPI\API\Dockerfile
对于构建上下文值,我输入了
APIRootName
,它可能不是在您的代理上运行,而是在托管代理上运行?遇到这个解决方案非常有帮助。最后,我使用buildContext:“$(Build.SourcesDirectory)”将docker指向存储库的根文件夹。
APIRootName
- MyAPI
- API
- Dockerfile
Another folder representation: APIRootName\MyAPI\API\Dockerfile