Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Docker support? #763

Description

@atp-tha

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.

Activity

  1. SteveSandersonMS commented on Mar 15, 2017

    @SteveSandersonMS
    Member

    The dockerfiles we removed in this commit were working correctly: c9526dd. If you want to use them with a csproj-based project, replace microsoft/dotnet:1.1.0-sdk-projectjson with microsoft/dotnet:1.1.0-sdk-msbuild.

  2. atp-tha commented on Mar 16, 2017

    @atp-tha
    Author

    @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"]
    
  3. SteveSandersonMS commented on Mar 16, 2017

    @SteveSandersonMS
    Member

    That Dockerfile won'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?

  4. atp-tha commented on Mar 22, 2017

    @atp-tha
    Author

    @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.

    1. Create an Angular 2 Project from yo
    2. Install Docker for Windows
    3. Open it up in Visual Studio 2017
    4. Right-click the project -> Add -> Docker Support
    5. A project called 'docker-compose' will be created inside the same solution, along with a Dockerfile in your Angular 2 project.
    6. Add nodejs installation codes into that Dockerfile.
    7. Start debugging in docker-compose project, it will start building your Angular 2 Project using that Dockerfile and run it in a container.
    8. After the container started running, you'll soon get this error.
  5. SteveSandersonMS commented on Mar 22, 2017

    @SteveSandersonMS
    Member

    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.

  6. glennc commented on Apr 10, 2017

    @glennc
    Member

    Bit late on this, but there is an ASP.NET image that contains Node, the aspnetcore-build image. 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions