When, where and how does Visual Studio 2017 set the DOCKER_BUILD_SOURCE environment variable When, where and how does Visual Studio 2017 set the DOCKER_BUILD_SOURCE environment variable docker docker

When, where and how does Visual Studio 2017 set the DOCKER_BUILD_SOURCE environment variable


I believe it has to do with doing some setup that can be used with Visual Studio Team Services CI/CD. However when run locally, that value is empty and if you look at the docker file, you see that if the value is empty, it substitutes "obj/Docker/publish"

Dockerfile:

FROM microsoft/aspnetcore:1.0

ARG source

WORKDIR /app

EXPOSE 80

COPY ${source:-obj/Docker/publish} .

ENTRYPOINT ["dotnet", "app.dll"]

However for me, i don't actually see that folder or anything in it. Where the "magic" happens is in the volumes section. that essentially moves your code onto the container as a bind mound. this is where your code gets moved onto the container. There are a few other things that happen that aren't clear to me though because I see a line in the build output where the code gets built/published, but not the actual command that is running.


This has no real impact when building development images. As Nick explained we get code using bind mount.

This is used when building images for production use with file docker-compose.ci.build.yml, which outputs to obj/Docker/publish of each solution web project.