Hello
What is the best way of setting up a development environment using .net core and docker? From the examples I've seen, it seems that you have to redeploy everything everytime you make a code change. I'm trying to get a setup where I can do development in visual
studio code + docker with debugging and without having to compile and restart the docker container
I had hoped that i could mount my local project so that docker would read the files that I work in, but I have a bit of problems with getting everything to work.
I've created a new project:
`dotnet new httpapi`
which creates a working project with a docker file:
FROM microsoft/aspnetcore-build:1.0-2.0 as BUILD
COPY ./ /apps
WORKDIR /apps
RUN bash -c "dotnet restore ./MountAndWatchTest.csproj && dotnet publish ./MountAndWatchTest.csproj -c Release -o ./obj/Docker/publish"
FROM microsoft/dotnet
WORKDIR /apps
EXPOSE 80
COPY --from=BUILD /apps/obj/Docker/publish .
ENTRYPOINT ["dotnet", "MountAndWatchTest.dll"]
I have tried to:
- Mount the src directory from docker-compose
- change the docker file to:
FROM microsoft/dotnet
WORKDIR /src
EXPOSE 80
RUN dotnet restore
RUN dotnet run
The idea is to change it to "dotnet watcher run" later and hopefully get it to update on code changes.
I'm able to run 'dotnet run' locally and get a server up and running on port 5000, but when I do it in docker I get a:
'Couldn't find a project to run. Ensure a project exists in /src, or pass the path to the project using --project.'
even though it works locally.
Firstly: Am I on the right path, or is there a better way to develop through a docker container? Or should I develop locally and move it to a container at deploy time? In that case I'm worried about the environment not being the same as that is running on the server.