While following a couple .NET Core 2.0 Visual Studio Team Services Continuous Integration/Continuous Delivery examples I bumped into a copy error in VSTS.
Adding docker support via VS17 works great locally with a dockerfile like this.
FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "myapp.dll"]
With an MVC app and a WebAPI app it worked well with docker-compose locally.
When adding a VSTS CI build process and running it I kept hitting errors with the copy.
Building myapp Service 'myapp' failed to build: COPY failed: GetFileAttributesEx \?\C:\Windows\TEMP\docker-builder91\obj\Docker\publish: The system cannot find the path specified. C:\Program Files\Docker\docker-compose.exe failed with return code: 1
The workaround that I've found is from this blog.
Note that they hit an error on a linux docker machine
Solution:
Make a Dockerfile.ci like this
It also requires modifying the .dockerignore file.
This allows me to continue the CI process, however I assume there's an easier fix to the problem.
I managed to build the service from within VSTS and copy them to the Docker image. I used .Net Core VSTS tasks to build and publish to "obj/Docker/Publish" folder and used "Docker-compose" tasks to build and publish docker container to private container repository.