gpt4 book ai didi

azure - 如何将 Azure 文件共享添加为 Azure Pipeline 中的卷

转载 作者:行者123 更新时间:2023-12-03 06:07:25 25 4
gpt4 key购买 nike

我正在使用 Azure Devops 构建 Docker 容器并将其推送到容器注册表。

我需要启用持久存储。所以我创建了一个文件系统和一个文件共享。现在,我该如何在部署后将此文件共享添加到生成的 Web 应用程序容器中?说在/var/www/html/shared_storage 路径

我的管道 yml 文件是:

trigger:
- master

resources:
- repo: self

variables:
dockerRegistryServiceConnection: 'xxxx'
imageRepository: 'xxx'
containerRegistry: 'xxx.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
vmImageName: 'ubuntu-latest'

- stage: Build_Master
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
displayName: Build master
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
master

我希望我可以指定连接详细信息,然后提供类似以下内容:卷共享存储:/var/www/html/shared_storage

但我似乎找不到任何相关文档。

最佳答案

您可以使用以下 Azure CLI 命令将存储帐户装载到 Azure Web App for Containers:

az webapp config storage-account add --resource-group MyResourceGroup --name MyUniqueApp \
--custom-id CustomId --storage-type AzureFiles \
--account-name MyStorageAccount --share-name MyShare \
--access-key MyAccessKey --mount-path /path/to/mount

此外,如果使用 Web 应用程序,在 Azure 门户中,您可以转到“配置”->“路径映射”并将“存储挂载”添加到其中的文件系统。

关于azure - 如何将 Azure 文件共享添加为 Azure Pipeline 中的卷,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77180811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com