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.

Working example using Visual Studio 2017 and docker? #768

Description

@fbeltrao

Hi there,

I am struggling trying to run the template application inside Docker.
Looks to me that JavaScriptServices can't find nodejs on the docker image microsoft/aspnetcore:1.1

I get the error "An exception of type 'System.AggregateException' occurred in System.Private.CoreLib.ni.dll but was not handled in user code"

I tried to modify the Dockerfile adding nodejs the following way:
FROM microsoft/aspnetcore:1.1
RUN apt-get update
RUN apt-get -qq update
RUN apt-get install -y nodejs npm
#debian installs node as nodejs
RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "MyApp.dll"]

Still without success.

Using the following dockerfile works (because the docker image has nodejs installed):
FROM microsoft/aspnetcore-build
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "MyApp.dll"]

I just think it is overkill to have this 1.19GB image (compared to 268 MB from aspnetcore) just to run the aspnetcore + nodejs.

Would it be possible to create a sample application where Docker is working?

Activity

  1. mpriem commented on Mar 16, 2017

    @mpriem

    +1

    What a coincidence. I was troubleshooting the exact same issue. As Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.LaunchNodeProcess(ProcessStartInfo startInfo) refers to node by processname 'node', the Exception is thrown.

  2. SteveSandersonMS commented on Mar 16, 2017

    @SteveSandersonMS
    Member

    The following worked for me:

    FROM microsoft/dotnet:1.1-sdk-msbuild
    
    RUN apt-get update
    RUN wget -qO- https://deb.nodesource.com/setup_6.x | bash -
    RUN apt-get install -y build-essential nodejs
    
    COPY . /app
    
    WORKDIR /app
    
    RUN ["dotnet", "restore"]
    RUN ["dotnet", "build"]
    
    EXPOSE 5000/tcp
    
    CMD ["dotnet", "run", "--server.urls", "http://0.0.0.0:5000"]
    

    Note that it was also necessary to modify Program.cs, adding .UseUrls("http://0.0.0.0:5000") before .Build().

    I just think it is overkill to have this 1.19GB image (compared to 268 MB from aspnetcore) just to run the aspnetcore + nodejs.

    If you find a more compact way to do it, please let us know - we can then add it to the wiki page here for others who are also interested in using Docker with this.

    BTW nothing in this setup is specific to VS2017. If you're trying to enable a special VS2017 feature, I'm afraid that's outside my area of expertise.

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