We are trying to use Azure Pipelines to build Docker image for a Dot Net Core App. When setting up the pipeline if I check "default build context" will it automatically pick the Dockerfile from my root directory?
Dockerfile is currently in the root directory but I want to move the Dockerfile inside the api project. How do I setup the pipeline so the docker build command is executed from root directory but refer to Dockerfile inside the project?
I haven't tried this, but something like this should work:
- 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
Version 2 of the task has support for setting build context:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With