我想创建一个简单的asp.net核心应用程序并将其部署到Windows Server 2016 Docker容器中。
这是我的服务器操作系统,我提取了最新的nanoserver基本映像
我读到了os compability的内容,但不明白怎么了。
默认的asp.net核心应用程序docker文件如下
FROM microsoft/dotnet:2.1-aspnetcore-runtime-nanoserver-1803 AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk-nanoserver-1803 AS build
我必须如何为我的虚拟服务器更改它?
答案 0 :(得分:0)
我解决了更改版本的问题,码头工人的最终版本看起来像
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-nanoserver-sac2016 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-nanoserver-sac2016 AS build
WORKDIR /src
COPY ["App8/App8.csproj", "App8/"]
RUN dotnet restore "App8/App8.csproj"
COPY . .
WORKDIR "/src/App8"
RUN dotnet build "App8.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "App8.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "App8.dll"]