Aspnetcore-angular-universal: Question: docker support

Created on 19 Apr 2017  路  9Comments  路  Source: TrilonIO/aspnetcore-angular-universal

I need to pack production build to docker image and on docker run command - > dotnet publish
it fails with message:

[email protected] install /app/node_modules/fsevents
node install

npm WARN prefer global [email protected] should be installed with -g
npm ERR! Linux 4.9.13-moby
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.8.2
npm ERR! npm v2.15.11
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package @angular/[email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @ngx-translate/[email protected] wants @angular/core@>=2.0.0 || >=4.0.0-beta.0
npm ERR! peerinvalid Peer [email protected] wants @angular/core@>=2.0.0 <5.0.0
npm ERR! peerinvalid Peer [email protected] wants @angular/core@>=2.0.0
npm ERR! peerinvalid Peer [email protected] wants @angular/core@^2.4.0
npm ERR! peerinvalid Peer [email protected] wants @angular/core@^2.3.1 || >=4.0.0
npm ERR! peerinvalid Peer [email protected] wants @angular/core@^4.0.0-rc.5
npm ERR! peerinvalid Peer [email protected] wants @angular/core@>=4.0.0-rc <5.0.0

npm ERR! Please include the following file with any support request:
npm ERR! /app/npm-debug.log
/app/Asp2017.csproj(50,5): error MSB3073: The command "npm install" exited with code 1.
The command '/bin/sh -c dotnet publish Asp2017.csproj' returned a non-zero code: 1

I guess it something related to webpack and files. On my mac dotnet publish works without issues.

Docker FAQ

Most helpful comment

Just in case, here is my DockerFile

FROM microsoft/aspnetcore:1.1.2

RUN apt-get update
RUN apt-get install -y nodejs
RUN ln -s `which nodejs` /usr/bin/node

ARG source=./src/bin/release/netcoreapp1.1/publish
WORKDIR /app
COPY $source .

ENV ASPNETCORE_ENVIRONMENT="Production"

EXPOSE 80
ENTRYPOINT ["dotnet", "MyApp.dll"]

All 9 comments

dotnet publish is error'ing with that, or Docker?

Just tried publish on windows with a fresh repo and it worked fine.

Is it something related to these wanting 2.x?
npm ERR! peerinvalid Peer [email protected] wants @angular/core@>=2.0.0
npm ERR! peerinvalid Peer [email protected] wants @angular/core@^2.4.0

on my mac it also works dotnet publish without any issues. But once it is from docker -> Asp2017.csproj runs npm install it fails with massage from top comment

docker file:
FROM microsoft/dotnet:1.1-sdk-msbuild

RUN wget -qO- https://deb.nodesource.com/setup_4.x | bash -
RUN apt-get update
RUN apt-get install -y build-essential nodejs

ENV ASPNETCORE_URLS="http://*:5000"
ENV ASPNETCORE_ENVIRONMENT="Production"
COPY . ./app

WORKDIR /app

RUN dotnet restore Asp2017.csproj

RUN dotnet publish Asp2017.csproj

EXPOSE 5000

ENTRYPOINT ["dotnet", "run"]

just tried to build seed project with docker and got kind of same error. looks like it requires zone.js@^0.8.4 but in project 0.7.6 . I seed there was latest 0.8.4 at some point of time and then it was reverted back to 0.7.6 . Is it because it is not supported yet?!

or maybe it is not related at all.

Don't think that'd be an issue, but I did update it to 0.8.5.

Take a look here and see if this info can help with Docker support:
https://github.com/aspnet/JavaScriptServices/pull/772

looks like ngx translate has strict dependancy not higher then beta.0 @ngx-translate/[email protected] wants @angular/core@>=2.0.0 || >=4.0.0-beta.0

@ocombe Is there an issue with the peerDependencies it looks like they're still >=2.0.0 for ngx-translate 6.0.1 ? (Sorry to bug you again 馃巵 )

Yes the peer dependencies are >=2.0.0 which means Angular v2 or v4 (both work)

Excellent ok thank you Olivier, just making sure!

Just in case, here is my DockerFile

FROM microsoft/aspnetcore:1.1.2

RUN apt-get update
RUN apt-get install -y nodejs
RUN ln -s `which nodejs` /usr/bin/node

ARG source=./src/bin/release/netcoreapp1.1/publish
WORKDIR /app
COPY $source .

ENV ASPNETCORE_ENVIRONMENT="Production"

EXPOSE 80
ENTRYPOINT ["dotnet", "MyApp.dll"]
Was this page helpful?
0 / 5 - 0 ratings