本文介绍了如何docker dotnet核心角度模板应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用dotnet cli角度模板创建了一个Web应用程序.
I created a web application using the dotnet cli angular template.
dotnet new anguar Web
现在,我想对这个应用程序进行docker化.我将以下Dockerfile添加到项目文件夹中.
Now I want to dockerize this application. I added the following Dockerfile to the project folder.
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Web.dll"]
然后在项目文件夹中运行以下命令.
And then run the following command when I am in the project folder.
sudo docker build -t accman-web .
但是我遇到以下错误:
要如何构建此简单应用程序的图像?
What do I have to do to build the image of this simple application?
推荐答案
对于Angular,您似乎需要nodejs和npm,这似乎已经丢失了.将此添加到您的Dockerfile中以在容器中安装nodejs和npm:
You need nodejs and npm for Angular, which seems to be missing. Add this to your Dockerfile to install nodejs and npm in the container:
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
请参见这博客文章以获取更多详细信息
See this blog post for more details
这篇关于如何docker dotnet核心角度模板应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!