Repository navigation
Docker support? #763
Description
Activity
The dockerfiles we removed in this commit were working correctly: c9526dd. If you want to use them with a
csproj-based project, replacemicrosoft/dotnet:1.1.0-sdk-projectjsonwithmicrosoft/dotnet:1.1.0-sdk-msbuild.@SteveSandersonMS
It didn't work with VS2017's docker support which enable you to debug an app running inside a docker container built using docker-compose.The code below is Dockerfile automatically generated from that feature and worked well with normal web app project.
FROM microsoft/aspnetcore:1.1 ARG source WORKDIR /app EXPOSE 80 COPY ${source:-obj/Docker/publish} . ENTRYPOINT ["dotnet", "MyProjectNamespace"]That
Dockerfilewon't work because it doesn't set up Node in the docker image.It didn't work with VS2017's docker support which enable you to debug an app running inside a docker container built using docker-compose.
Sorry, I don't personally know the details of how that works, or what extra thing you'd need in this case. @glennc Do you know what special setup is needed to make VS2017 docker debugging work with an ASP.NET Core project where Node is also installed into the container image?
@SteveSandersonMS Yes that generated file didn't work, and this was my edited Dockerfile back then.
FROM microsoft/aspnetcore:1.1 RUN apt-get update RUN wget -qO- https://deb.nodesource.com/setup_6.x | bash - RUN apt-get install -y build-essential nodejs ARG source WORKDIR /app EXPOSE 80 COPY ${source:-obj/Docker/publish} . ENTRYPOINT ["dotnet", "BuilkConnect.Web.Api.dll"]That seemed to work and the project and docker image were successfully built. However, after it started running there's an unhandled System.AggregateException from this line:
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true });And I cannot expand it to explore the details.
Following steps below should reproduce the issue for you.
- Create an Angular 2 Project from yo
- Install Docker for Windows
- Open it up in Visual Studio 2017
- Right-click the project -> Add -> Docker Support
- A project called 'docker-compose' will be created inside the same solution, along with a Dockerfile in your Angular 2 project.
- Add nodejs installation codes into that Dockerfile.
- Start debugging in docker-compose project, it will start building your Angular 2 Project using that Dockerfile and run it in a container.
- After the container started running, you'll soon get this error.
OK, thanks for the info. Could you have a look at the suggestions in #772 and see if they cover what you're looking for? I'm not personally familiar with anything nonstandard that VS2017 does with Docker so might not be able to help with that.
Bit late on this, but there is an ASP.NET image that contains Node, the
aspnetcore-buildimage. If all you need is Node does that image work for you? It might not be completely perfect because the image also contains a lot of NuGet packages that you probably don't need for your scenario, making it bigger on-disk. Unless you are compiling in the container?
When added docker support through VS2017, the project threw an exception from UseWebpackDevMiddleware (which I cannot expand the bubble to see details).
I remembered there was a Dockerfile included with project.json, so I tried using some of its code in VS's generated Dockerfile but it didn't work and threw the same exception.
Please advise.