I have project in dotnet I would like to containerize in Azure DevOps. I used https://github.com/MicrosoftDocs/mslearn-tailspin-spacegame-web-deploy (and the tutorial: https://docs.microsoft.com/en-us/learn/modules/create-multi-stage-pipeline/6-promote-staging ) as a test. I wanted to keep the original multistage pipeline that contained the DotNetCoreCLI@2 restore, build and publish commands, and I would just want to copy the artifact to the container, pointing at the right dll.
My dockerfile looks like this:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
ARG workdir
COPY /$workdir App/
WORKDIR /App
ENTRYPOINT ["dotnet", "Tailspin.SpaceGame.Web.dll"]
Even if I use the /$workdir which is a passed argument in the docker task, it looks for the $workdir within the temporary docker environment:
##[error]COPY failed: stat /var/lib/docker/tmp/docker-builder513641162/home/vsts/work/1/a/Release: no such file or directory
Is there a way to reuse the artifact with Docker without publishing it to Azure Artifacts and downloading it again from the internet?
Here is my artifact publish and Docker task in case of confusion:
- publish: '$(Build.ArtifactStagingDirectory)'
artifact: drop
- task: Docker@2
inputs:
containerRegistry: 'ACR Service Connection'
repository: 'Tailspin.SpaceGame-$(buildConfiguration)'
command: 'build'
Dockerfile: '**/Dockerfile'
arguments: '--build-arg workdir="$(Build.ArtifactStagingDirectory)/$(buildConfiguration)"'