Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Dockerfile for an ASP.NET Core 2.1 Angular Project

I'm a complete newbie on Docker and currently trying to create an ASP.NET Core 2.1 with Angular project. I'm using a Linux Container on Docker for Windows and my IDE is VS2017 community edition.

Currently, I'm receiving this error:

[1] Ensure that 'npm' is installed and can be found in one of the PATH directories. Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Make sure the executable is in one of those directories, or update your PATH.

I believe I need to install Node.js in my Docker instance or whatever you call that, and it should be through Dockerfile. Please point out my mistakes in my assumption. And how to ensure that the dependencies will be installed regardless on what kind of container I'm using? I'm expecting that my future projects will be installed on different platforms.

like image 347
eSPiYa Avatar asked Jun 14 '18 14:06

eSPiYa


1 Answers

In the microsoft/dotnet:2.1-aspnetcore-runtime container image npm/nodejs is not installed. To install this in the container update the docker file

FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base

# Setup NodeJs
RUN apt-get update && \
    apt-get install -y wget && \
    apt-get install -y gnupg2 && \
    wget -qO- https://deb.nodesource.com/setup_6.x | bash - && \
    apt-get install -y build-essential nodejs
# End setup

WORKDIR /app
EXPOSE 80

Only Angular CLI live reload is not working.

like image 151
Marcel Avatar answered Nov 19 '22 11:11

Marcel