在本地,build命令可以工作并输出图像文件,但是自动构建似乎无法找到.csproj文件。我尝试了Dockerfile的不同配置,但结果似乎仍然相同。我也在使用带有npm模块的React。
最新的Dockerfile
FROM microsoft/aspnetcore-build AS builder
WORKDIR /source
# caches restore result by copying csproj file separately
COPY *.csproj .
RUN dotnet restore
# copies the rest of your code
COPY . .
RUN dotnet publish --output /app/ --configuration Release
# Stage 2
FROM microsoft/aspnetcore
WORKDIR /app
COPY --from=builder /app .
ENTRYPOINT ["dotnet", "dotnetapp.dll"]