我的Dockerfile看起来像这样:
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build
WORKDIR /projectName
COPY . .
RUN nuget restore
COPY . .
WORKDIR /repoName/projectName
RUN msbuild ./projectName.csproj /p:Configuration=Debug在本地,msbuild步骤没有给我带来任何问题。如果没有.dockerignore文件,构建将失败:
Process is terminated due to StackOverflowException.当我添加一个如下所示的.dockerignore文件时...
./.git
./.idea
./.vs
./gen
./packages
./irrelevantProject1
./irrelevantProject2
# etc...the构建再次失败,但出现了不同的错误消息:
CompilerServer: server failed - server rejected the request 'Error reading response: Reached end of stream before end of read.' - b6c5574e-55ea-4d7d-adb3-e156ebd65296
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB6006: "csc.exe" exited with code -2146232797. [C:\repoName\projectName\projectName.csproj]
Done Building Project "C:\repoName\projectName\projectName.csproj" (default targets) -- FAILED.
Build FAILED.
"C:\repoName\projectName\projectName.csproj" (default target) (1) ->
(CoreCompile target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB6006: "csc.exe" exited with code -2146232797. [C:\repoName\projectName\projectName.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:31.66
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; msbuild ./projectName.csproj /p:Configuration=Debug' returned a non-zero code: 1我已经被这个问题困扰了好几天了。任何建议都将不胜感激。
发布于 2021-09-29 21:56:44
为构建分配更多的内存解决了这个问题。
docker build -t projectName -m 4g .https://stackoverflow.com/questions/69195544
复制相似问题