gpt4 book ai didi

docker - 在 Azure Pipelines 中指定 Dockerfile 路径

转载 作者:行者123 更新时间:2023-12-02 17:59:33 27 4
gpt4 key购买 nike

我们正在尝试使用 Azure Pipelines 为 Dot Net Core 应用程序构建 Docker 镜像。在设置管道时,如果我选中“默认构建上下文”,它会自动从我的根目录中选择 Dockerfile 吗?

Dockerfile 当前位于根目录中,但我想将 Dockerfile 移动到 api 项目中。如何设置管道以便从根目录执行 docker build 命令,但引用项目内的 Dockerfile?

enter image description here

最佳答案

我没有试过这个,但这样的事情应该有效:

- task: Docker@1
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: my_service_connection
imageName: bla-bla-bla
dockerFile: src/app/dockerfile
buildContext: $(Build.Repository.LocalPath)

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/docker?view=azure-devops#task-inputs

该任务的第 2 版支持设置构建上下文:

enter image description here

关于docker - 在 Azure Pipelines 中指定 Dockerfile 路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56268770/

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