But once the image is built (docker-compose up) I get following error message in the console:
Unhandled Exception: System.AggregateException: One or more errors occurred. (Failed to start Node process. To resolve this:.
[1] Ensure that Node.js 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 Node executable is in one of those directories, or update your PATH.
Dockerfile:
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS Base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM microsoft/dotnet:2.2-sdk as build
# Install node and npm
ENV NODE_VERSION 8.12.0
ENV NODE_DOWNLOAD_SHA 3df19b748ee2b6dfe3a03448ebc6186a3a86aeab557018d77a0f7f3314594ef6
ENV NODE_DOWNLOAD_URL https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz
RUN wget "$NODE_DOWNLOAD_URL" -O nodejs.tar.gz \
&& echo "$NODE_DOWNLOAD_SHA nodejs.tar.gz" | sha256sum -c - \
&& tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \
&& rm nodejs.tar.gz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y nodejs
RUN npm install
# Restore dotnet before build to allow for caching
WORKDIR /
COPY MyProject.Common/MyProject.Common.csproj /src/MyProject.Common/
COPY MyProject.Data/MyProject.Data.csproj /src/MyProject.Data/
COPY MyProject.DomainClasses/MyProject.DomainClasses.csproj /src/MyProject.DomainClasses/
COPY MyProject.Services/MyProject.Services.csproj /src/MyProject.Services/
COPY MyProject.Tests/MyProject.Tests.csproj /src/MyProject.Tests/
COPY MyProject.ViewModel/MyProject.ViewModel.csproj /src/MyProject.ViewModel/
COPY MyProject.Web/MyProject.Web.csproj /src/MyProject.Web/
RUN dotnet restore /src/MyProject.Web/MyProject.Web.csproj
# Copy source files and build
COPY . /src
RUN dotnet build /src/MyProject.Web/MyProject.Web.csproj --no-restore -c Release
RUN dotnet publish /src/MyProject.Web/MyProject.Web.csproj --no-restore -c Release -o /app
# Copy compiled app to runtime container
FROM base AS final
COPY --from=build /app .
CMD ["dotnet", "MyProject.Web.dll"]
I have added webpack as part of my project using UseWebpackMiddleware:
But once the image is built (
docker-compose up
) I get following error message in the console:Dockerfile:
Any idea?