我想在具有特定库(例如 ibnss3-dev)的 Linux 应用服务上运行我的 .net 5 应用。
我有构建管道:
trigger:
- main
pool:
vmImage: ubuntu-20.04
variables:
buildConfiguration: 'Release'
wwwrootDir: 'Web/wwwroot'
dotnetSdkVersion: '5.0.x'
- script: |
sudo apt-get update
sudo apt-get install -y libnss3-dev
displayName: 'Dep install'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core SDK $(dotnetSdkVersion)'
inputs:
version: '$(dotnetSdkVersion)'
- script: 'echo "$(Build.DefinitionName), $(Build.BuildId), $(Build.BuildNumber)" > buildinfo.txt'
displayName: 'Write build info'
workingDirectory: $(wwwrootDir)
- task: DotNetCoreCLI@2
displayName: 'Restore project dependencies'
inputs:
command: 'restore'
projects: '**/Web.csproj'
- task: DotNetCoreCLI@2
displayName: 'Build the project - $(buildConfiguration)'
inputs:
command: 'build'
arguments: '--no-restore --configuration $(buildConfiguration)'
projects: '**/Web.csproj'
- task: DotNetCoreCLI@2
displayName: 'Publish the project - $(buildConfiguration)'
inputs:
command: 'publish'
projects: '**/Web.csproj'
publishWebProjects: false
arguments: '--no-build --configuration Release --output $(Build.ArtifactStagingDirectory)/Release'
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
condition: succeeded()
以及带有 Azure 应用服务部署的版本(任务版本 4)
我该怎么做?我尝试了以下解决方案,但它们都不起作用:
- 使用 sudo 发布部署后操作 (kuduPostDeploymentScript.sh: sudo: not found)
- 不使用 sudo 发布部署后操作([错误]E:缺少列表目录 /var/lib/apt/lists/partial。- 获取(13:权限被拒绝))
- 在管道中添加脚本步骤
我可以通过 ssh 手动运行 install 命令,但我正在寻找一种自动化的方法。
apt-get update
apt-get install -y libnss3-dev