c# - .net core,在 docker 中运行默认的 Angular 模板
问题描述
我正在尝试将 .NET Core 3.1 中的默认角度模板作为 docker 实例运行。
我已经在不同的页面(也在这里)上读到添加以下内容就足够了。
RUN apt-get update && \
apt-get install -y wget && \
apt-get install -y gnupg2 && \
wget -qO- https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y build-essential nodejs
但我仍然收到以下错误:
/bin/sh: 2: /tmp/tmp859332ce906f4bcaad00b1b144b3fec4.exec.cmd: npm: not found
/src/Internationaal-Dashboard/Internationaal-Dashboard.csproj(42,5): error MSB3073: The command "npm install" exited with code 127.
The command '/bin/sh -c dotnet publish "Internationaal-Dashboard.csproj" -c Release -o /app/publish' returned a non-zero code: 1
有人知道我忘记了什么。
我将在下面包含完整的 docker 文件:
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
RUN apt-get update && \
apt-get install -y wget && \
apt-get install -y gnupg2 && \
wget -qO- https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y build-essential nodejs
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["Internationaal-Dashboard/Internationaal-Dashboard.csproj", "Internationaal-Dashboard/"]
RUN dotnet restore "Internationaal-Dashboard/Internationaal-Dashboard.csproj"
COPY . .
WORKDIR "/src/Internationaal-Dashboard"
RUN dotnet build "Internationaal-Dashboard.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Internationaal-Dashboard.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Internationaal-Dashboard.dll"]
解决方案
推荐阅读
- javascript - Webpack 替换 html 注释标签之间的内容
- c# - 如何从不区分大小写的 JSON 中反序列化布尔值?
- spring - java.lang.NullPointerException:在 org.apache.tiles.access.TilesAccess.getContainer 处为空(TilesAccess.java:124)~[tiles-api-3.0.8.jar:3.0.8]
- python - 如何将 sqlalchemy declarative_base() 类的子类映射到 Teradata 数据库中的表?
- circuit-sdk - 如何访问 Circuit 沙箱?
- python - 如何导入导入本地模块的远程模块?
- drupal - Drupal 8分类术语相同级别
- javascript - 如何在 HTML 中调试换行(回车)事件
- android - Android 意图选择器 - 导航应用
- django - DRF:聚合相似条目名称