![](/img/trans.png)
[英]CS0016 using dotnet build/publish with --output parameter when running in Server Core Docker EE container
[英]Docker dotnet publish output not found
我正在嘗試使用 dockerfile 成功構建/發布項目。 但是,出於某種原因,它找不到應該創建的輸出文件夾。 從其他帖子來看,我的 docker 文件中的一切看起來都是正確的。
文件
FROM mcr.microsoft.com/dotnet/sdk:5.0 as build
WORKDIR /app
COPY . .
RUN dotnet restore
RUN dotnet publish ./ClassLibrary2.csproj -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /app/out .
ENTRYPOINT ["dotnet", "ClassLibrary2.dll"]
目錄
Docker 命令(從 docker 文件所在的文件夾運行):docker build -f Dockerfile-SignedAssembly -t signed-assembly。 輸出:
只需替換COPY --from=build /app/out.
通過COPY --from=build /out.
如下所示
FROM mcr.microsoft.com/dotnet/sdk:5.0 as build
WORKDIR /app
COPY . .
RUN dotnet restore
RUN dotnet publish ./ClassLibrary2.csproj -c Release -o /out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /out .
ENTRYPOINT ["dotnet", "ClassLibrary2.dll"]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.