2017-09-08 5 views
0

I有しdotnet new web -o fooによって生成された.NETコアウェブアプリケーション、および以下の(多段)Dockerfileドッカー多段コア2.0が原因DLLを行方不明の失敗.NETで構築:S

FROM microsoft/dotnet:2.0-sdk AS builder 

WORKDIR /build 

COPY ./foo/foo.csproj . 
RUN dotnet restore 

COPY ./foo/*.cs ./ 
RUN dotnet publish --configuration Release --output ./app 

FROM microsoft/dotnet:2.0-runtime 

WORKDIR /app 

COPY --from=builder /build/app/* ./ 

ENTRYPOINT ["dotnet", "./foo.dll"] 

ビルイメージは正常に動作しますが、実行しません。

PS> docker build . -t foo 
# ... 
Successfully built <hash> 
Successfully tagged foo:latest 
PS> docker run --rm foo 
Error: 
    An assembly specified in the application dependencies manifest (foo.deps.json) was not found: 
    package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1' 
    path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll' 
    This assembly was expected to be in the local runtime store as the application was published using the following target manifest files: 
    aspnetcore-store-2.0.0-linux-x64.xml;aspnetcore-store-2.0.0-osx-x64.xml;aspnetcore-store-2.0.0-win7-x64.xml;aspnetcore-store-2.0.0-win7-x86.xml 

すべての必須アセットが出力ディレクトリに公開されているとは限りません。私はこの仕事をするために何をする必要がありますか?

答えて

3

同じ問題にgithub issueanotherは一つの解決策はあります:

ASP.NETコアランタイムストアは、「ランタイムのみ」の画像には含まれていません。代わりに、microsoft/aspnetcore:2.0.0を使用するか、ランタイムストアのトリミングをオプトアウトする必要があります。

または(2)あなたの依存関係のアセンブリが公開された出力にコピーされるようにトリミングパブリッシュ時無効:あなたは小さいイメージをしたいとあなたが行うことができ、コードを変更することができる場合

<PropertyGroup> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> </PropertyGroup>

関連する問題